예제 #1
0
 public function fromVersion(StreamName $streamName, AggregateIdInterface $aggregateId, $version)
 {
     if (!$this->redis->exists($this->getNamespaceKey($streamName, $aggregateId))) {
         throw new EventStreamNotFoundException($aggregateId);
     }
     $serializedEvents = $this->redis->lrange($this->getNamespaceKey($streamName, $aggregateId), 0, $version);
     return $this->processEvents($serializedEvents);
 }
예제 #2
0
파일: PredisTest.php 프로젝트: gmo/cache
 /**
  * @group redis-lists
  */
 public function testListRightPushExists()
 {
     $this->assertEquals(0, $this->client->rpushx('foo', 'bar'));
     $this->assertFalse($this->client->exists('foo'));
     $this->client->rpush('foo', 'hello');
     $this->assertEquals(2, $this->client->rpushx('foo', 'world'));
     $this->assertEquals(array('hello', 'world'), $this->client->lrange('foo', 0, -1));
 }
예제 #3
0
 /**
  * Delete a key from the cache
  *
  * @param string $key Identifier for the data
  * @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed
  */
 public function delete($key)
 {
     $key = $this->_key($key);
     if (!$this->client->exists($key)) {
         return false;
     }
     return $this->client->del($key) === 1;
 }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 protected function doContains($id)
 {
     return $this->client->exists($id);
 }
예제 #5
0
 /**
  * {@inheritDoc}
  */
 public function exists($key)
 {
     return $this->predis->exists($key);
 }
예제 #6
0
 /**
  * Does the cache contain data with this key
  *
  * @param $key
  * @return mixed
  */
 public function contains($key)
 {
     return (bool) $this->redisClient->exists($key);
 }