public function testGetConfigCaching() { $reflectedClass = new ReflectionClass('CM_Class_Abstract'); $configCacheList = $reflectedClass->getProperty('_classConfigList'); $configCacheList->setAccessible(true); CM_Config::get()->CM_Class_Implementation = new stdClass(); CM_Config::get()->CM_Class_Implementation->foo = 'foo'; $this->assertSame('foo', CM_Class_Implementation::getConfig()->foo); CM_Config::get()->CM_Class_Implementation->foo = 'bar'; $this->assertSame('foo', CM_Class_Implementation::getConfig()->foo); $configCacheList->setValue([]); $this->assertSame('foo', CM_Class_Implementation::getConfig()->foo); $cache = new CM_Cache_Storage_Apc(); $cache->flush(); $this->assertSame('foo', CM_Class_Implementation::getConfig()->foo); $configCacheList->setValue([]); $this->assertSame('bar', CM_Class_Implementation::getConfig()->foo); }
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)); }