/** * Get the value related to the specified key * * @param string $key * * @return string|bool: If key didn't exist, FALSE is returned. Otherwise, the value related to this key is returned. * @link http://redis.io/commands/get * @example $redis->get('key'); */ public function get($key) { try { return $this->client->get($key); } catch (Exception $e) { return $this->handleException($e, __FUNCTION__, func_get_args()); } }
public function testBatchCommandsAreNotSentTwice() { $this->redis->del('testBatchCommand'); $this->assertTrue($this->redis->stream()); $this->assertTrue($this->redis->incr('testBatchCommand')); $this->assertSame([], $this->redis->exec()); $this->assertEquals(1, $this->redis->get('testBatchCommand')); $this->assertEquals(2, $this->redis->incr('testBatchCommand')); $this->assertTrue($this->redis->stream()); $this->assertTrue($this->redis->incr('testBatchCommand')); $this->assertSame([], $this->redis->exec()); $this->assertEquals(3, $this->redis->get('testBatchCommand')); }
/** * Get new value and write to cache. */ private function getFromRedis($key) { $value = $this->redis->get($key); $this->cachedSet($key, $value, 0, false); return $value; }