public function tearDown() { if (function_exists('zend_shm_cache_clear')) { zend_shm_cache_clear(); } parent::tearDown(); }
/** * Clear datas with $uid key * @param mixed $uid * @return void */ public function clear($uid = null) { if ($uid) { return zend_shm_cache_delete($uid); } return zend_shm_cache_clear(); }
/** * {@inheritdoc} */ protected function doFlush() { $namespace = $this->getNamespace(); if (empty($namespace)) { return zend_shm_cache_clear(); } return zend_shm_cache_clear($namespace); }
/** * Remove items of given namespace * * @param string $namespace * @return bool */ public function clearByNamespace($namespace) { $namespace = (string) $namespace; if ($namespace === '') { throw new Exception\InvalidArgumentException('No namespace given'); } return zend_shm_cache_clear($namespace); }
/** * Clear items of the given namespace from Zend Data SHM Cache * * @param string $namespace * @return void * @throws Exception\RuntimeException */ protected function zdcClearByNamespace($namespace) { if (!zend_shm_cache_clear($namespace)) { throw new Exception\RuntimeException( "zend_shm_cache_clear({$namespace}) failed" ); } }
/** * @return bool */ protected function driverClear() { return @zend_shm_cache_clear(); }
/** * Empty out the cache in use as best it can * * It may only remove the files of a certain type (if the $type parameter is given) * Type can be user, data or left blank * - user clears out user data * - data clears out system / opcode data * - If no type is specified will perfom a complete cache clearing * For cache engines that do not distinguish on types, a full cache flush will be done * * @param string $type = '' */ function clean_cache($type = '') { global $cache_accelerator, $cache_uid, $cache_password, $cache_memcached, $memcached; switch ($cache_accelerator) { case 'memcached': if ((function_exists('memcache_flush') || function_exists('memcached_flush')) && !empty($cache_memcached)) { // Not connected yet? if (empty($memcached)) { get_memcached_server(); } if (!$memcached) { return; } // Clear it out, really invalidate whats there if (function_exists('memcache_flush')) { memcache_flush($memcached); } else { memcached_flush($memcached); } } break; case 'eaccelerator': if (function_exists('eaccelerator_clear') && function_exists('eaccelerator_clean')) { // Clean out the already expired items @eaccelerator_clean(); // Remove all unused scripts and data from shared memory and disk cache, // e.g. all data that isn't used in the current requests. @eaccelerator_clear(); } case 'mmcache': if (function_exists('mmcache_gc')) { // Removes all expired keys from shared memory, this is not a complete cache flush :( // @todo there is no clear function, should we try to find all of the keys and delete those? with mmcache_rm mmcache_gc(); } break; case 'apc': case 'apcu': if (function_exists('apc_clear_cache')) { // If passed a type, clear that type out if ($type === '' || $type === 'data') { apc_clear_cache('user'); apc_clear_cache('system'); } elseif ($type === 'user') { apc_clear_cache('user'); } } break; case 'zend': if (function_exists('zend_shm_cache_clear')) { zend_shm_cache_clear('ELK'); } break; case 'xcache': if (function_exists('xcache_clear_cache') && function_exists('xcache_count')) { // Xcache may need auth credentials, depending on how its been set up if (!empty($cache_uid) && !empty($cache_password)) { $_SERVER['PHP_AUTH_USER'] = $cache_uid; $_SERVER['PHP_AUTH_PW'] = $cache_password; } // Get the counts so we clear each instance $pcnt = xcache_count(XC_TYPE_PHP); $vcnt = xcache_count(XC_TYPE_VAR); // Time to clear the user vars and/or the opcache if ($type === '' || $type === 'user') { for ($i = 0; $i < $vcnt; $i++) { xcache_clear_cache(XC_TYPE_VAR, $i); } } if ($type === '' || $type === 'data') { for ($i = 0; $i < $pcnt; $i++) { xcache_clear_cache(XC_TYPE_PHP, $i); } } } break; } // To be complete, we also clear out the cache dir so we get any js/css hive files if (is_dir(CACHEDIR)) { // Remove the cache files in our disk cache directory $dh = opendir(CACHEDIR); while ($file = readdir($dh)) { if ($file != '.' && $file != '..' && $file != 'index.php' && $file != '.htaccess' && (!$type || substr($file, 0, strlen($type)) == $type)) { @unlink(CACHEDIR . '/' . $file); } } closedir($dh); } // Invalidate cache, to be sure! // ... as long as Load.php can be modified, anyway. @touch(SOURCEDIR . '/Load.php'); // Give addons a way to trigger cache cleaning. call_integration_hook('integrate_clean_cache'); clearstatcache(); }
public function clear() { $ret = @zend_shm_cache_clear($this->namespace); return $ret; }
/** * Deletes all values from cache. * This is the implementation of the method declared in the parent class. * @return boolean whether the flush operation was successful. * @since 1.1.5 */ protected function flushValues() { return zend_shm_cache_clear(); }
public function clear() { zend_shm_cache_clear(self::ZEND_NAMESPACE); }
function pmxCacheClean() { zend_shm_cache_clear('PMX'); // clear SMF settings cache cache_put_data('modSettings', null, 90); }
/** * Deletes all values from cache. * Be careful of performing this operation if the cache is shared by multiple applications. */ public function flush() { zend_shm_cache_clear(); }
/** * Clean some cache records * * Available modes are : * 'all' (default) => remove all cache entries ($tags is not used) * 'old' => unsupported * * @param string $mode clean mode * @param array $tags array of tags * @throws Zend_Cache_Exception * @return boolean true if no problem */ public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array()) { switch ($mode) { case Zend_Cache::CLEANING_MODE_ALL: return zend_shm_cache_clear($this->_options['namespace']); break; case Zend_Cache::CLEANING_MODE_OLD: $this->_log('Glitch_Cache_Backend_ZendShMem::clean() : CLEANING_MODE_OLD is unsupported by the ZendShMem backend'); break; default: Zend_Cache::throwException('Invalid mode for clean() method'); break; } }
/** * Remove items of given namespace * * @param string $namespace * @return boolean */ public function clearByNamespace($namespace) { return zend_shm_cache_clear($namespace); }
/** * {@inheritdoc} */ public function clear() { return zend_shm_cache_clear(); }
/** * @see SugarCacheAbstract::_resetExternal() */ protected function _resetExternal() { zend_shm_cache_clear(); }
/** * {@inheritdoc} */ protected function doFlush() { return empty($this->getNamespace()) ? zend_shm_cache_clear() : zend_shm_cache_clear($this->getNamespace()); }
/** * Clear cache */ protected function _clear() { zend_shm_cache_clear($this->_options['namespace']); }
public function clear() { zend_shm_cache_clear("MongoObject"); }