You are here

public function Redis_Tests_Cache_FlushUnitTestCase::testFlushIsTemporaryWithoutLifetime in Redis 7.3

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

File

lib/Redis/Tests/Cache/FlushUnitTestCase.php, line 75

Class

Redis_Tests_Cache_FlushUnitTestCase

Code

public function testFlushIsTemporaryWithoutLifetime() {
  $backend = $this
    ->getBackend();
  $this
    ->assertTrue($backend
    ->allowTemporaryFlush());
  $backend
    ->set('test10', 42, CACHE_PERMANENT);

  // Ugly concatenation with the mode, but it will be visible in tests
  // reports if the entry shows up, thus allowing us to know which real
  // test case is run at this time
  $backend
    ->set('test11', 'foo' . $backend
    ->isSharded(), CACHE_TEMPORARY);
  $backend
    ->set('test12', 'bar' . $backend
    ->isSharded(), time() + 10);
  $backend
    ->clear();
  $cache = $backend
    ->get('test10');
  $this
    ->assertNotEqual(false, $cache);
  $this
    ->assertEqual($cache->data, 42);
  $this
    ->assertFalse($backend
    ->get('test11'));
  $cache = $backend
    ->get('test12');
  $this
    ->assertNotEqual(false, $cache);
}