本文整理汇总了PHP中Predis\ClientInterface::ttl方法的典型用法代码示例。如果您正苦于以下问题:PHP ClientInterface::ttl方法的具体用法?PHP ClientInterface::ttl怎么用?PHP ClientInterface::ttl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\ClientInterface
的用法示例。
在下文中一共展示了ClientInterface::ttl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: it_sets_an_expiry_when_registering_used_nonces
/**
* @test
*/
public function it_sets_an_expiry_when_registering_used_nonces()
{
$this->nonceProvider->registerNonceAndTimestamp('foo', 500, $this->consumer);
$remainingTtl = $this->client->ttl('nonces/key:abc/timestamp:500');
$this->assertLessThanOrEqual(NonceProvider::DEFAULT_TTL, $remainingTtl);
$this->assertGreaterThanOrEqual(NonceProvider::DEFAULT_TTL - 1, $remainingTtl);
}
示例2: testPreciseSetEx
/**
* @group redis-strings
*/
public function testPreciseSetEx()
{
$this->assertEquals('OK', $this->client->psetex('foo', 20000, 'bar'));
$this->assertEquals('OK', $this->client->psetex('foo', 20000, 'baz'));
$this->assertSame('baz', $this->client->get('foo'));
$this->assertThat($this->client->ttl('foo'), $this->logicalAnd($this->greaterThan(0), $this->lessThanOrEqual(20)));
}
示例3: testSettingACustomExpiration
/**
* @test
*/
public function testSettingACustomExpiration()
{
$token = $this->tokenProvider->getAccessTokenByToken('nnch734d00sl2jdk');
$serializedToken = serialize($token);
$key = 'tokenProvider/token/key:nnch734d00sl2jdk';
$this->tokenProviderCache->cacheSet($key, $serializedToken, 500);
$ttl = $this->client->ttl($key);
$this->assertEquals(500, $ttl);
}