本文整理汇总了PHP中JCache::gc方法的典型用法代码示例。如果您正苦于以下问题:PHP JCache::gc方法的具体用法?PHP JCache::gc怎么用?PHP JCache::gc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCache
的用法示例。
在下文中一共展示了JCache::gc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGc
/**
* Testing Gc().
*
* @return void
*/
public function testGc()
{
$this->object = JCache::getInstance('output', array('lifetime' => 2, 'defaultgroup' => ''));
$this->object->store(
'Now is the time for all good people to throw a party.',
42,
''
);
$this->object->store(
'And this is the cache that tries men\'s souls',
42,
''
);
sleep(5);
$this->object->gc();
$this->assertThat(
$this->object->get(42, ''),
$this->isFalse(),
'Should not retrieve the data properly'
);
$this->assertThat(
$this->object->get(42, ''),
$this->isFalse(),
'Should not retrieve the data properly'
);
}
示例2: testGc
/**
* Testing Gc().
*
* @medium
*
* @return void
*/
public function testGc()
{
$this->object = JCache::getInstance('output', array('lifetime' => 2, 'defaultgroup' => ''));
$this->object->store($this->testData_A, 42, '');
$this->object->store($this->testData_B, 43, '');
sleep(5);
$this->object->gc();
$this->assertFalse($this->object->get(42, ''));
$this->assertFalse($this->object->get(43, ''));
}