本文整理汇总了PHP中Predis\ClientInterface::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP ClientInterface::exists方法的具体用法?PHP ClientInterface::exists怎么用?PHP ClientInterface::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\ClientInterface
的用法示例。
在下文中一共展示了ClientInterface::exists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromVersion
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: testListRightPushExists
/**
* @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: delete
/**
* 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: doContains
/**
* {@inheritdoc}
*/
protected function doContains($id)
{
return $this->client->exists($id);
}
示例5: exists
/**
* {@inheritDoc}
*/
public function exists($key)
{
return $this->predis->exists($key);
}
示例6: contains
/**
* Does the cache contain data with this key
*
* @param $key
* @return mixed
*/
public function contains($key)
{
return (bool) $this->redisClient->exists($key);
}