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); }
/** * @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)); }
/** * 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; }
/** * {@inheritdoc} */ protected function doContains($id) { return $this->client->exists($id); }
/** * {@inheritDoc} */ public function exists($key) { return $this->predis->exists($key); }
/** * Does the cache contain data with this key * * @param $key * @return mixed */ public function contains($key) { return (bool) $this->redisClient->exists($key); }