cache_mode = CACHE_DISABLED; } function get($key) { return $this->_is_cache_disabled() ? FALSE : parent::get($key); } function set($key, $value, $expire = CACHE_PERMANENT, $headers = NULL) { return $this->_is_cache_disabled() ? FALSE : parent::set($key, $value, $expire, $headers); } function delete($key) { # FIXME handle "*" as the key. $this->flush() ? if (($offset = strpos($key, '*')) !== FALSE) { # FIXME delete static cache # this code is almost equal to $this->flush() $this->lock(); $lookup = $this->memcache->get($this->lookup); if (empty($lookup)) { $this->unlock(); return TRUE; } foreach ($lookup as $k => $v) { if (strncasecmp($k, $this->key($key), $offset) == 0) { if ($this->memcache->delete($k)) { unset($lookup[$k]); } } } $this->memcache->set($this->lookup, $lookup, $this->settings['compress'], 0); // Remove lock $this->unlock(); } else { parent::delete($key); } } private function _is_cache_disabled() { # OPT: If cache is NOT disabled don't even call variable_get() if (CACHE_DISABLED == $this->cache_mode) { return ($this->cache_mode = variable_get('cache', CACHE_DISABLED)) == CACHE_DISABLED; } return FALSE; } }