• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Redis\Database类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: flushItems

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


示例17: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct(array $server)
 {
     parent::__construct($server);
 }
开发者ID:fahmiardi,项目名称:oauth2-server-storage-redis,代码行数:7,代码来源:RedisCapsule.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Routing\Controller类代码示例发布时间:2022-05-23
下一篇:
PHP Jobs\Job类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap