当前位置: 首页>>代码示例>>PHP>>正文


PHP Redis\Database类代码示例

本文整理汇总了PHP中Illuminate\Redis\Database的典型用法代码示例。如果您正苦于以下问题:PHP Database类的具体用法?PHP Database怎么用?PHP Database使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Database类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createConnection

 /**
  * Create the given connection by name.
  *
  * @param  string  $name
  * @return Illuminate\Redis\Database
  */
 protected function createConnection($name)
 {
     $config = $this->getConfig($name);
     $connection = new Database($config['host'], $config['port'], $config['database']);
     $connection->connect();
     return $connection;
 }
开发者ID:defra91,项目名称:levecchiecredenze.it,代码行数:13,代码来源:RedisManager.php

示例2: __construct

 public function __construct(SessionManager $manager, Database $db)
 {
     parent::__construct($manager);
     $this->key = env('COMMON_SESSION');
     $this->redis = $db->connection('common');
     if ($this->redis === null) {
         throw new ResourceNotFoundException('Redis Common Connection is not exists.');
     }
 }
开发者ID:spyc,项目名称:elearn-foundation,代码行数:9,代码来源:CommonSession.php

示例3: command

 /**
  * Run a command against the Redis database.
  *
  * @param string $method
  * @param array $parameters
  * @return mixed 
  * @static 
  */
 public static function command($method, $parameters = array())
 {
     return \Illuminate\Redis\Database::command($method, $parameters);
 }
开发者ID:nmkr,项目名称:basic-starter,代码行数:12,代码来源:_ide_helper.php

示例4: psubscribe

 /**
  * Subscribe to a set of given channels with wildcards.
  *
  * @param array|string $channels
  * @param \Closure $callback
  * @param string $connection
  * @return void 
  * @static 
  */
 public static function psubscribe($channels, $callback, $connection = null)
 {
     \Illuminate\Redis\Database::psubscribe($channels, $callback, $connection);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:13,代码来源:_ide_helper.php

示例5:

 function __construct(RedisDatabase $redis)
 {
     $this->redis = $redis->connection();
 }
开发者ID:michaeljhopkins,项目名称:alexa-app,代码行数:4,代码来源:RedisCertificateProvider.php

示例6: exists

 /**
  * @param Update $update
  * @return bool
  */
 public function exists(Update $update)
 {
     if (!$this->redis->exists($update->getMessage()->getChat()->getId())) {
         return false;
     }
     return true;
 }
开发者ID:zarincheg,项目名称:telegram-bot-dialogs,代码行数:11,代码来源:Dialogs.php

示例7: deleteCacheGroup

 /**
  * @param $group
  */
 protected function deleteCacheGroup($group)
 {
     $keys = $this->redis->keys($group . '*');
     if (!empty($keys)) {
         $this->redis->del($keys);
     }
 }
开发者ID:sandeeprajoria,项目名称:Housekeeper,代码行数:10,代码来源:AbstractCacheManager.php

示例8: testDelete

 public function testDelete()
 {
     $job = new RedisQueueIntegrationTestJob(30);
     $this->queue->push($job);
     /** @var RedisJob $redisJob */
     $redisJob = $this->queue->pop();
     $redisJob->delete();
     $this->assertEquals(0, $this->redis->connection()->zcard('queues:default:delayed'));
     $this->assertEquals(0, $this->redis->connection()->zcard('queues:default:reserved'));
     $this->assertEquals(0, $this->redis->connection()->llen('queues:default'));
     $this->assertNull($this->queue->pop());
 }
开发者ID:halaei,项目名称:hredis,代码行数:12,代码来源:RedisQueueIntegrationTest.php

示例9: command

 /**
  * Run a command against the Redis database.
  *
  * @param  string  $method
  * @param  array  $args
  * @return mixed
  */
 public final function command($method, array $args = [])
 {
     if (in_array(strtolower($method), array_keys($this->storeEncoded))) {
         $values = $this->storeEncoded[strtolower($method)];
         $from = array_get($values, 'from', 0);
         $to = array_get($values, 'to', max(0, count($args) - 1));
         for ($i = $from; $i <= $to; $i++) {
             $args[$i] = $this->encode($args[$i]);
         }
     }
     if ($method == 'mset' || $method == 'msetnx') {
         if (count($args) === 1 && is_array($args[0])) {
             foreach ($args[0] as $k => $v) {
                 $args[0][$k] = $this->encode($v);
             }
         } else {
             foreach ($args as $k => $v) {
                 if ($k % 2 != 0) {
                     $args[$k] = $this->encode($v);
                 }
             }
         }
     }
     if ($method == 'zadd') {
         if (is_array(end($args))) {
             foreach (array_pop($args) as $k => $v) {
                 $args[][$k] = $this->encode($v);
             }
         } else {
             foreach ($arguments as $k => $v) {
                 if ($k !== 0 && $k % 2 == 0) {
                     $arguments[$k] = $this->encode($v);
                 }
             }
         }
     }
     if (in_array(strtolower($method), $this->returnDecoded)) {
         $result = parent::command($method, $args);
         if (is_array($result)) {
             return array_map(function ($value) {
                 return $this->decode($value);
             }, $result);
         }
         return $this->decode($result);
     }
     return parent::command($method, $args);
 }
开发者ID:CupOfTea696,项目名称:CardsAgainstTea,代码行数:54,代码来源:Database.php

示例10: migrateExpiredJobs

 /**
  * Migrate the delayed jobs that are ready to the regular queue.
  *
  * @param  string  $from
  * @param  string  $to
  * @return void
  */
 public function migrateExpiredJobs($from, $to)
 {
     $options = ['cas' => true, 'watch' => $from, 'retry' => 10];
     $this->redis->transaction($options, function ($transaction) use($from, $to) {
         // First we need to get all of jobs that have expired based on the current time
         // so that we can push them onto the main queue. After we get them we simply
         // remove them from this "delay" queues. All of this within a transaction.
         $jobs = $this->getExpiredJobs($transaction, $from, $time = $this->getTime());
         // If we actually found any jobs, we will remove them from the old queue and we
         // will insert them onto the new (ready) "queue". This means they will stand
         // ready to be processed by the queue worker whenever their turn comes up.
         if (count($jobs) > 0) {
             $this->removeExpiredJobs($transaction, $from, $time);
             $this->pushExpiredJobsOntoNewQueue($transaction, $to, $jobs);
         }
     });
 }
开发者ID:AlexCutts,项目名称:framework,代码行数:24,代码来源:RedisQueue.php

示例11: remove

 /**
  * Remove an item with a given key, index or value.
  *
  * @param  string  $key
  * @param  string  $value
  * @param  string  $type
  * @return bool
  */
 public function remove($key, $value, $type = null)
 {
     if (is_null($type)) {
         $type = $this->type($key);
     }
     switch ($type) {
         case 'list':
             $key = str_replace(':queued', '', $key);
             $random = Str::quickRandom(64);
             $this->database->lset($key, $value, $random);
             return $this->database->lrem($key, 1, $random);
         case 'zset':
             return $this->database->zrem($key, $value);
         default:
             throw new UnexpectedValueException("Unable to delete {$value} from {$key}. List type {$type} not supported.");
     }
 }
开发者ID:ipalaus,项目名称:redisqueue,代码行数:25,代码来源:Repository.php

示例12: connection

 /**
  * Get the Redis connection instance.
  *
  * @return \Predis\ClientInterface
  */
 public function connection()
 {
     return $this->redis->connection($this->connection);
 }
开发者ID:mubassirhayat,项目名称:Laravel51-starter,代码行数:9,代码来源:RedisStore.php

示例13: getConnection

 /**
  * Get the connection for the queue.
  *
  * @return \Predis\ClientInterface
  */
 protected function getConnection()
 {
     return $this->redis->connection($this->connection);
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:9,代码来源:RedisQueue.php

示例14: flush

 /**
  * Remove all items from the cache.
  *
  * @return void
  */
 public function flush()
 {
     $this->redis->flushdb();
 }
开发者ID:shinichi81,项目名称:laravel4demo,代码行数:9,代码来源:RedisStore.php

示例15: removeExpiredJobs

 /**
  * Remove the delayed jobs that are ready for processing.
  *
  * @param  string  $queue
  * @param  int     $time
  * @return void
  */
 protected function removeExpiredJobs($queue, $time)
 {
     $this->redis->zremrangebyscore($queue, '-inf', $time);
 }
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:11,代码来源:RedisQueue.php


注:本文中的Illuminate\Redis\Database类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。