freeze() public method

All data in a frozen backend remains unchanged and methods which try to add or modify data result in an exception thrown. Possible expiry times of individual cache entries are ignored. A frozen backend can only be thawn by calling the flush() method.
public freeze ( ) : void
return void
コード例 #1
0
 /**
  * @test
  */
 public function freezeInvokesRedis()
 {
     $this->redis->expects($this->once())->method('lRange')->with('Foo_Cache:entries', 0, -1)->will($this->returnValue(['entry_1', 'entry_2']));
     $this->redis->expects($this->exactly(2))->method('persist');
     $this->redis->expects($this->once())->method('set')->with('Foo_Cache:frozen', true);
     $this->backend->freeze();
 }
コード例 #2
0
 /**
  * @test
  */
 public function freezeFreezesTheCache()
 {
     $this->assertFalse($this->backend->isFrozen());
     for ($i = 0; $i < 10; $i++) {
         $this->backend->set('entry_' . $i, 'foo');
     }
     $this->backend->freeze();
     $this->assertTrue($this->backend->isFrozen());
 }