public function Redis_Tests_Cache_AbstractFlushUnitTestCase::testFlushIsTemporaryWithLifetime in Redis 7.2
Tests that with a default cache lifetime temporary non expired items are kept even when in temporary flush mode.
File
- lib/
Redis/ Tests/ Cache/ AbstractFlushUnitTestCase.php, line 61
Class
Code
public function testFlushIsTemporaryWithLifetime() {
global $conf;
$conf['redis_flush_mode_cache'] = 1;
$conf['cache_lifetime'] = 1000;
$backend = $this
->getBackend();
$this
->assertEqual(Redis_Cache_Base::FLUSH_TEMPORARY, $backend
->getClearMode());
$backend
->set('test7', 42, CACHE_PERMANENT);
$backend
->set('test8', 'foo', CACHE_TEMPORARY);
$backend
->set('test9', 'bar', time() + 1000);
$backend
->clear();
$cache = $backend
->get('test7');
$this
->assertNotEqual(false, $cache);
$this
->assertEqual($cache->data, 42);
$cache = $backend
->get('test8');
$this
->assertNotEqual(false, $cache);
$this
->assertEqual($cache->data, 'foo');
$cache = $backend
->get('test9');
$this
->assertNotEqual(false, $cache);
$this
->assertEqual($cache->data, 'bar');
}