public function testFetchTtlBasedItem() { $instance = new FixedInMemoryLruCache(5); $instance->save('foo', 'Bar', 3); $this->assertTrue($instance->contains('foo')); $this->assertEquals('Bar', $instance->fetch('foo')); sleep(4); $this->assertFalse($instance->contains('foo')); $this->assertFalse($instance->fetch('foo')); }
/** * @dataProvider ttlConstantProvider */ public function testTtlConstantAccess($ttl) { $instance = new FixedInMemoryLruCache(5); $instance->save('foo', 'Bar', $ttl); $this->assertEquals('Bar', $instance->fetch('foo')); }