function get_item_key($key) { /** * Allow to modify page key by W3TC plugins */ $key = w3tc_do_action('w3tc_' . $this->_module . '_cache_key', $key); return $key; }
/** * Returns cache key * * @param string $sql * @return string */ function _get_cache_key($sql) { $key = sprintf('w3tc_%s_sql_%s', w3_get_host_id(), md5($sql)); /** * Allow to modify cache key by W3TC plugins */ $key = w3tc_do_action('w3tc_dbcache_cache_key', $key); return $key; }
/** * Returns cache key * * @param string $id * @param string $group * @return string */ function _get_cache_key($id, $group = 'default') { if (!$group) { $group = 'default'; } $blog_id = w3_get_blog_id(); $key_cache_id = $blog_id . $group . $id; if (isset($this->_key_cache[$key_cache_id])) { $key = $this->_key_cache[$key_cache_id]; } else { $host = w3_get_host(); if (in_array($group, $this->global_groups)) { $host_id = $host; } else { $host_id = sprintf('%s_%d', $host, $blog_id); } $key = sprintf('w3tc_%s_object_%s', $host_id, md5($group . $id)); $this->_key_cache[$key_cache_id] = $key; } /** * Allow to modify cache key by W3TC plugins */ $key = w3tc_do_action('w3tc_objectcache_cache_key', $key); return $key; }
/** * Constructs item key * @param $name * @return string */ public function get_item_key($name) { $key = sprintf('w3tc_key_%s_%d_%s_%s', $this->_host, $this->_blog_id, $this->_module, $name); /** * Allow to modify cache key by W3TC plugins */ $key = w3tc_do_action('w3tc_' . $this->_module . '_cache_key', $key); return $key; }
/** * Returns page key * * @param string $request_uri * @param string $mobile_group * @param string $referrer_group * @param string $encryption * @param string $compression * @return string */ function _get_page_key($request_uri, $mobile_group = '', $referrer_group = '', $encryption = false, $compression = false) { // replace fragment $key = preg_replace('~#.*$~', '', $request_uri); if ($this->_enhanced_mode) { // URL decode $key = urldecode($key); // replace double slashes $key = preg_replace('~[/\\\\]+~', '/', $key); // replace query string $key = preg_replace('~\\?.*$~', '', $key); // replace index.php $key = str_replace('/index.php', '/', $key); // trim slash $key = ltrim($key, '/'); if ($key && substr($key, -1) != '/') { $key .= '/'; } $key .= '_index'; } else { $key = sprintf('w3tc_%s_page_%s', w3_get_host_id(), md5($key)); } /** * Append mobile group */ if ($mobile_group) { $key .= '_' . $mobile_group; } /** * Append referrer group */ if ($referrer_group) { $key .= '_' . $referrer_group; } /** * Append encryption */ if ($encryption) { $key .= '_' . $encryption; } if ($this->_enhanced_mode) { /** * Append HTML extension */ $key .= '.html'; /** * Append compression extension */ if ($compression) { $key .= '.' . $compression; } } else { /** * Append compression */ if ($compression) { $key .= '_' . $compression; } } /** * Allow to modify page key by W3TC plugins */ $key = w3tc_do_action('w3tc_pgcache_cache_key', $key); return $key; }