當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。