Example #1
0
 public function testPurgeByTag()
 {
     $this->assertFalse($this->instance->read('fooBar'));
     $key = $this->instance->save('fooBar', 'some content');
     $this->assertSame(32, strlen($key));
     $this->instance->purgeByTag(['cacheAll']);
     $result = $this->instance->read('fooBar');
     $this->assertFalse($result);
     $key = $this->instance->save('fooBar', 'some content', null, ['customTag']);
     $this->assertSame(32, strlen($key));
     $this->instance->purgeByTag(['customTag']);
     $result = $this->instance->read('fooBar');
     $this->assertFalse($result);
     $key = $this->instance->save('fooBar', 'some content', null, ['customTag']);
     $this->assertSame(32, strlen($key));
     $this->instance->purgeByTag(['someOtherTag']);
     $result = $this->instance->read('fooBar');
     $this->assertNotFalse($result);
     $this->instance->purgeByTag(['cacheAll', 'customTag', 'someOtherTag']);
     $result = $this->instance->read('fooBar');
     $this->assertNotFalse($result);
     $this->instance->purgeByTag(['cacheAll', 'customTag']);
     $result = $this->instance->read('fooBar');
     $this->assertFalse($result);
 }