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


PHP ClientInterface::get方法代码示例

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


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

示例1: read

 /**
  * {@inheritdoc}
  */
 public function read($sessionId)
 {
     if ($data = $this->redis->get($sessionId)) {
         return $data;
     }
     return '';
 }
开发者ID:robbert-vdh,项目名称:bolt,代码行数:10,代码来源:RedisHandler.php

示例2: doFetch

 /**
  * {@inheritdoc}
  */
 protected function doFetch($id)
 {
     $result = $this->client->get($id);
     if (null === $result) {
         return false;
     }
     return unserialize($result);
 }
开发者ID:zqcloveping,项目名称:pagekit,代码行数:11,代码来源:PredisCache.php

示例3: read

 /**
  * Read a key from the cache
  *
  * @param string $key Identifier for the data
  * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
  */
 public function read($key)
 {
     $key = $this->_key($key);
     $value = $this->client->get($key);
     if ($value === null) {
         return false;
     }
     return ctype_digit($value) ? (int) $value : unserialize($value);
 }
开发者ID:renan,项目名称:cakephp-predis,代码行数:15,代码来源:PredisEngine.php

示例4: testCacheSet

 /**
  * @test
  */
 public function testCacheSet()
 {
     $token = $this->tokenProvider->getAccessTokenByToken('nnch734d00sl2jdk');
     $serializedToken = serialize($token);
     $key = 'tokenProvider/token/key:nnch734d00sl2jdk';
     $this->tokenProviderCache->cacheSet($key, $serializedToken);
     $cachedToken = $this->client->get($key);
     $this->assertEquals($serializedToken, $cachedToken);
 }
开发者ID:cultuurnet,项目名称:symfony-security-oauth-redis,代码行数:12,代码来源:TokenProviderCacheTest.php

示例5: getPosts

 /**
  * @return array
  */
 public function getPosts() : array
 {
     if ($this->redisClient !== null) {
         $posts = $this->redisClient->get('posts');
         if ($posts) {
             return json_decode($posts, true);
         }
     }
     $blog = $this->getBlogInfo();
     $posts = $this->thumblrClient->getBlogPosts($blog['name'], ['type' => 'text'])->posts;
     $posts = json_encode($posts, JSON_PRETTY_PRINT);
     if ($this->redisClient !== null) {
         $this->redisClient->set('posts', $posts);
         $this->redisClient->expireat('posts', time() + 3600);
     }
     return json_decode($posts, true);
 }
开发者ID:devigner,项目名称:devigner.io,代码行数:20,代码来源:TumblrModel.php

示例6: preRequestHandle

 /**
  * @param SessionInterface $session
  * @param Request $request
  */
 private function preRequestHandle(SessionInterface $session, Request $request)
 {
     $id = $request->cookie($this->key);
     $key = 'session:' . $id;
     if (!Str::equals($key, $session->getId())) {
         $this->redis->del($key);
         return;
     }
     $value = $this->redis->get('session:' . $key);
     $content = Json::parse($value);
     if ($content['last_seen'] > $session->get('last_seen')) {
         foreach ($content as $key => $value) {
             if (!Str::startsWith($key, ['_', 'login_'])) {
                 $session->set($key, $value);
             }
         }
     }
 }
开发者ID:spyc,项目名称:elearn-foundation,代码行数:22,代码来源:CommonSession.php

示例7: get

 /**
  * @param string $key
  *
  * @return mixed
  */
 public function get($key)
 {
     $key = $this->getKeyName($key);
     $value = $this->client->get($key);
     $this->addReadAccessStats($key);
     $result = json_decode($value, true);
     if (json_last_error() === \JSON_ERROR_SYNTAX) {
         return $value;
     }
     return $result;
 }
开发者ID:spryker,项目名称:Storage,代码行数:16,代码来源:Service.php

示例8: testSetRange

 /**
  * @group redis-strings
  */
 public function testSetRange()
 {
     $this->assertSame(9, $this->client->setrange('foo', 4, 'World'));
     $this->assertSame("World", $this->client->get('foo'));
     $this->client->set('foo', 'Hello World');
     $this->assertSame(14, $this->client->setrange('foo', 6, 'Universe'));
     $this->assertSame('Hello Universe', $this->client->get('foo'));
     $this->client->set('foo', 'bar');
     $this->assertSame(9, $this->client->setrange('foo', 6, 'baz'));
     $this->assertSame("barbaz", $this->client->get('foo'));
 }
开发者ID:gmo,项目名称:cache,代码行数:14,代码来源:PredisTest.php

示例9: get

 /**
  * {@inheritDoc}
  */
 public function get($key)
 {
     return $this->predis->get($key);
 }
开发者ID:php-resque,项目名称:resque,代码行数:7,代码来源:PredisBridge.php

示例10: cacheGet

 /**
  * Get the cached token for a key.
  *
  * @param $key
  * @return string
  */
 protected function cacheGet($key)
 {
     $cachedToken = $this->client->get($key);
     return $cachedToken;
 }
开发者ID:cultuurnet,项目名称:symfony-security-oauth-redis,代码行数:11,代码来源:TokenProviderCache.php

示例11: get

 /**
  * Gets a cache entry
  * returning null if not in cache
  *
  * @param $key
  * @return null|mixed
  */
 public function get($key)
 {
     return $this->serializer->deserialize($this->client->get($key));
 }
开发者ID:genkgo,项目名称:cache,代码行数:11,代码来源:PredisAdapter.php

示例12: fetch

 /**
  * Fetch some data from the cache with this key
  *
  * @param $key
  * @return string
  */
 public function fetch($key)
 {
     return $this->redisClient->get($key);
 }
开发者ID:kabudu,项目名称:forecast-tools,代码行数:10,代码来源:RedisCacheHandler.php


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