You are here

public function Redis_Tests_Cache_AbstractFlushUnitTestCase::testFlushIsTemporaryWithoutLifetime in Redis 7.2

Tests that with no default cache lifetime all temporary items are droppped when in temporary flush mode.

File

lib/Redis/Tests/Cache/AbstractFlushUnitTestCase.php, line 92

Class

Redis_Tests_Cache_AbstractFlushUnitTestCase

Code

public function testFlushIsTemporaryWithoutLifetime() {
  global $conf;
  $conf['redis_flush_mode_cache'] = 1;
  $conf['cache_lifetime'] = 0;
  $backend = $this
    ->getBackend();
  $this
    ->assertEqual(Redis_Cache_Base::FLUSH_TEMPORARY, $backend
    ->getClearMode());
  $backend
    ->set('test10', 42, CACHE_PERMANENT);
  $backend
    ->set('test11', 'foo', CACHE_TEMPORARY);
  $backend
    ->set('test12', 'bar', time() + 10);
  $backend
    ->clear();
  $cache = $backend
    ->get('test10');
  $this
    ->assertNotEqual(false, $cache);
  $this
    ->assertEqual($cache->data, 42);
  $this
    ->assertFalse($backend
    ->get('test11'));
  $this
    ->assertFalse($backend
    ->get('test12'));
}