Exemplo n.º 1
0
 public function testFlush()
 {
     $cache = new CM_Cache_Storage_File();
     $cache->set('foo', 'bar');
     $this->assertSame('bar', $cache->get('foo'));
     $cache->flush();
     $this->assertFalse($cache->get('foo'));
 }
Exemplo n.º 2
0
 public function ajax_clearCache(CM_Params $params, CM_Frontend_JavascriptContainer_View $handler, CM_Http_Response_View_Ajax $response)
 {
     $cachesCleared = array();
     if ($params->getBoolean('CM_Cache_Storage_Memcache', false)) {
         $cache = new CM_Cache_Storage_Memcache();
         $cache->flush();
         $cachesCleared[] = 'CM_Cache_Storage_Memcache';
     }
     if ($params->getBoolean('CM_Cache_Storage_Apc', false)) {
         $cache = new CM_Cache_Storage_Apc();
         $cache->flush();
         $cachesCleared[] = 'CM_Cache_Storage_Apc';
     }
     if ($params->getBoolean('CM_Cache_Storage_File', false)) {
         $cache = new CM_Cache_Storage_File();
         $cache->flush();
         $cachesCleared[] = 'CM_Cache_Storage_File';
     }
     $handler->message('Cleared: ' . implode(', ', $cachesCleared));
 }