コード例 #1
0
 /**
  * @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
0
ファイル: PredisTest.php プロジェクト: gmo/cache
 /**
  * @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)));
 }
 /**
  * @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);
 }