_timeout = intval($config['timeout']); } if (isset($config['prefix'])) { $this->_prefix = $config['prefix']; } } function set($key, &$value) { if (!apc_store($this->_prefix . $key, $value, $this->_timeout)) { return FALSE; } return TRUE; } function &get($key) { return apc_fetch($this->_prefix . $key); } function delete($key) { return apc_delete($this->_prefix . $key); } function flush() { $allinfo = apc_cache_info('user'); $keys = $allinfo['cache_list']; $prefix = $this->_prefix . "CRM_"; // Our keys follows this pattern: ([A-Za-z0-9_]+)?CRM_[A-Za-z0-9_]+ $lp = strlen($prefix); // Get prefix length foreach ($keys as $key) { $name = $key['info']; if ($prefix == substr($name,0,$lp)) { // Ours? apc_delete($this->_prefix . $name); } } } }