public function testFlush() { parent::testFlush(); $this->assertTableHasNRecords('jlx_cache', 3); $this->assertTrue(jCache::flush($this->profile)); $this->assertTableIsEmpty('jlx_cache'); }
public function testFlush() { parent::testFlush(); $this->assertTrue(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush1DataKey.cache')); $this->assertTrue(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush2DataKey.cache')); $this->assertTrue(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush3DataKey.cache')); $this->assertTrue(jCache::flush($this->profile)); $this->assertFalse(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush1DataKey.cache')); $this->assertFalse(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush2DataKey.cache')); $this->assertFalse(file_exists(jApp::tempPath() . 'cache/usingfile/jelix_cache___flush3DataKey.cache')); }
public function testFlush() { parent::testFlush(); $mmc = memcache_connect($this->mmhost, $this->mmport); $this->assertTrue(memcache_get($mmc, 'flush1DataKey')); $this->assertTrue(memcache_get($mmc, 'flush2DataKey')); $this->assertTrue(memcache_get($mmc, 'flush3DataKey')); $this->assertTrue(jCache::flush($this->profile)); $this->assertFalse(memcache_get($mmc, 'flush1DataKey')); $this->assertFalse(memcache_get($mmc, 'flush2DataKey')); $this->assertFalse(memcache_get($mmc, 'flush3DataKey')); }
public function testFlush() { $this->assertFalse(jCache::flush()); // prepare data for overriding methods jCache::set('flush1DataKey', 'some data', 0, $this->profile); jCache::set('flush2DataKey', 'data to remove', strtotime("+1 day"), $this->profile); jCache::set('flush3DataKey', 'other data to remove', time() + 30, $this->profile); }
public function flushAll() { jCache::flush('jforms'); $this->containers = array(); }
/** * clear right cache */ public function clearCache() { $this->acl = null; $this->aclres = array(); $this->anonacl = null; $this->anonaclres = array(); jCache::flush('acl2db'); }
public static function clearLayerCache($repository, $project, $layer) { // Storage type $ser = lizmap::getServices(); $cacheStorageType = $ser->cacheStorageType; // Cache root directory if ($cacheStorageType != 'redis') { $cacheRootDirectory = $ser->cacheRootDirectory; if (!is_writable($cacheRootDirectory) or !is_dir($cacheRootDirectory)) { $cacheRootDirectory = sys_get_temp_dir(); } // Directory where cached files are stored for the project $cacheProjectDir = $cacheRootDirectory . '/' . $repository . '/' . $project . '/'; $results = array(); if (file_exists($cacheProjectDir)) { // Open the directory and walk through the filenames $handle = opendir($cacheProjectDir); while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { // Get directories and files corresponding to the layer if (preg_match('#(^|_)' . $layer . '($|_)#', $entry)) { $results[] = $cacheProjectDir . $entry; } } } closedir($handle); foreach ($results as $rem) { if (is_dir($rem)) { jFile::removeDir($rem); } else { unlink($rem); } } } } else { // FIXME: removing by layer is not supported for the moment. For the moment, we flush all layers of the project. $cacheName = 'lizmapCache_' . $repository . '_' . $project; self::declareRedisProfile($ser, $cacheName, $repository, $project); jCache::flush($cacheName); } jEvent::notify('lizmapProxyClearLayerCache', array('repository' => $repository, 'project' => $project, 'layer' => $layer)); }