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


PHP Redis::get方法代码示例

本文整理汇总了PHP中Redis::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Redis::get方法的具体用法?PHP Redis::get怎么用?PHP Redis::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Redis的用法示例。


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

示例1: get

 /**
  * Returns cached value by key
  *
  * @param string $key
  * @return bool|mixed
  */
 public function get($key)
 {
     if (false === ($value = $this->cache->get($this->prepareKey($key)))) {
         return false;
     }
     return $this->unserializeCompound($value);
 }
开发者ID:ihor,项目名称:cachalot,代码行数:13,代码来源:RedisCache.php

示例2: read

 /**
  * @inheritDoc
  */
 public function read($id)
 {
     if ($data = $this->_redis->get($this->getPrefixKey($id))) {
         return unserialize($data);
     }
     return null;
 }
开发者ID:kerisy,项目名称:framework,代码行数:10,代码来源:RedisStorage.php

示例3: retrieve

 /**
  * @inheritdoc
  */
 public function retrieve($key)
 {
     if (!$this->exists($key)) {
         return null;
     }
     return unserialize($this->redis->get($this->prefix . $key));
 }
开发者ID:icanboogie,项目名称:storage,代码行数:10,代码来源:RedisStorage.php

示例4: increment

 public static function increment($host)
 {
     $count = self::$redis->incrBy(self::$prefix . $host, 1);
     if (self::$redis->get(self::$prefix . $host) == 1) {
         self::$redis->setTimeout(self::$prefix . $host, self::$ttl);
     }
     return $count;
 }
开发者ID:ariarijp,项目名称:cassowary,代码行数:8,代码来源:RedisAdapter.php

示例5: get

 /**
  * Attempt to retrieve a value from the cache server, if not set it.
  *
  * @param string $key Key we can use to retrieve the data.
  *
  * @return bool|string False on failure or String, data belonging to the key.
  * @access public
  */
 public function get($key)
 {
     if ($this->connected === true && $this->ping() === true) {
         $data = $this->server->get($key);
         return $this->isRedis ? $this->IgBinarySupport ? igbinary_unserialize($data) : unserialize($data) : $data;
     }
     return false;
 }
开发者ID:sebst3r,项目名称:nZEDb,代码行数:16,代码来源:Cache.php

示例6: load

 /**
  * Loads item by cache key.
  * 
  * @param string $key
  * @return mixed
  * 
  * @throws StorageException if storage error occurs, handler can not be used
  */
 protected function load($key)
 {
     try {
         return $this->redis->get($key);
     } catch (\Exception $e) {
         throw new StorageException("Failed to load redis key: {$key}", 1, $e);
     }
 }
开发者ID:Nek-,项目名称:php-circuit-breaker,代码行数:16,代码来源:RedisAdapter.php

示例7: get

 /**
  * Get cache
  *
  * @param	string	Cache ID
  * @return	mixed
  */
 public function get($key)
 {
     $value = $this->_redis->get($key);
     if ($value !== FALSE && isset($this->_serialized[$key])) {
         return unserialize($value);
     }
     return $value;
 }
开发者ID:darkwebside,项目名称:Sprint,代码行数:14,代码来源:Cache_redis.php

示例8: get

 /**
  * Get a cache variable
  *
  * Retrieve a variable from the cache and return it's
  * value to the user.
  *
  * @param  string $name  The name of the cache variable to retrieve.
  *
  * @return mixed         The value of the retrieved variable or false if
  *                       variable isn't found.
  */
 public function get($name)
 {
     $key = $this->redis->get($name);
     if ($key !== false) {
         return unserialize($key);
     }
     return false;
 }
开发者ID:jeremykendall,项目名称:frapi,代码行数:19,代码来源:Redis.php

示例9: get

 /**
  * get var
  * @param $key
  * @param null $default
  * @return bool|mixed
  */
 public function get($key, $default = null)
 {
     $result = $this->redis->get($key);
     if ($result) {
         return $result;
     }
     return $default;
 }
开发者ID:jzxyouok,项目名称:simple-fork-php,代码行数:14,代码来源:RedisCache.php

示例10: getMy

 /**
  * @param $key
  * @return Option
  */
 public static function getMy($key)
 {
     $hash = self::hash($key);
     if (self::$redis->exists(self::myPrefix() . ":" . $hash)) {
         return Option::Some(unserialize(self::$redis->get(self::myPrefix() . ":" . $hash)));
     } else {
         return Option::None();
     }
 }
开发者ID:pldin601,项目名称:HomeMusic,代码行数:13,代码来源:RedisCache.php

示例11: get

 public function get($key)
 {
     $result = self::$cache->get($this->getNamespace() . $key);
     if ($result === false && !self::$cache->exists($this->getNamespace() . $key)) {
         return null;
     } else {
         return json_decode($result, true);
     }
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:9,代码来源:redis.php

示例12: get

 public function get($id, $default = NULL)
 {
     // Get the value from Redis
     $value = $this->_redis->get($id);
     if ($value == false) {
         $value = $default;
     }
     // Return the value
     return $value;
 }
开发者ID:sttt,项目名称:phpredis-kohana3.3,代码行数:10,代码来源:Redis.php

示例13: loadUserByOauth

 /**
  * @param int $provider
  * @param int $providerUserId
  *
  * @return bool|User
  *
  */
 public function loadUserByOauth($provider, $providerUserId)
 {
     if (!($userName = $this->redis->get('credentials:' . implode(':', array($provider, $providerUserId))))) {
         return false;
     }
     if (!($user = $this->loadUserByUsername($userName))) {
         return false;
     }
     return new User($user);
 }
开发者ID:bananos,项目名称:kanban,代码行数:17,代码来源:UserProvider.php

示例14: testStdClass

 public function testStdClass()
 {
     $data = new \stdClass();
     $data->a = 'a';
     $data->b = 'b';
     $key = new CacheKey('test', rand(1, 1000));
     $this->cache->set($key, $data);
     $val = $this->cache->get($key);
     $this->assertEquals($data, $val);
 }
开发者ID:PhanQuocTrung,项目名称:WeatherStation,代码行数:10,代码来源:RedisTest.php

示例15: __construct

 public function __construct()
 {
     $redis = new Redis();
     try {
         $redis->connect('127.0.0.1', 6379);
         $this->data = array('count' => $redis->get('cobbler:count'), 'speed' => $redis->get('cobbler:speed'));
         $redis->close();
     } catch (Exception $e) {
         $this->error(500, $e->getMessage());
     }
 }
开发者ID:episode17,项目名称:cobbler-web,代码行数:11,代码来源:index.php


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