public function Redis_Tests_Cache_FlushUnitTestCase::testFlushIsTemporaryWithLifetime in Redis 7.3
Tests that with a default cache lifetime temporary non expired items are kept even when in temporary flush mode.
File
- lib/
Redis/ Tests/ Cache/ FlushUnitTestCase.php, line 42
Class
Code
public function testFlushIsTemporaryWithLifetime() {
$GLOBALS['conf']['cache_lifetime'] = 112;
$backend = $this
->getBackend();
// Even though we set a flush mode into this bin, Drupal default
// behavior when a cache_lifetime is set is to override the backend
// one in order to keep the core behavior and avoid potential
// nasty bugs.
$this
->assertFalse($backend
->allowTemporaryFlush());
$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');
}