Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Branched Cache Structure

Raam Dev edited this page · 3 revisions

Branched Cache Structure

Quick Cache stores its cache files for each page of your site based on the PROTOCOL://HOST/URI that it's caching, inside the default Quick Cache cache directory located at wp-content/cache/quick-cache/cache/.

To see how this works, let's assume we have a post called "Sample Post" at the following URL: http://example.com/2014/05/sample-post/. When someone visits that URL, Quick Cache will parse out the following parts using the PHP superglobals $_SERVER['HTTPS'], $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']:

  • URL: http://example.com/2014/05/sample-post/
  • PROTOCOL: http
  • HOST: example.com
  • URI: /2014/05/sample-post/

From that information, Quick Cache will first check if there is an existing cache file to serve for that page. If none is found, it will build the cache file path, starting with the Quick Cache cache location (wp-content/cache/quick-cache/cache/) and creating any necessary subdirectories to reflect the path of the URI.

In our example, the following subdirectories are created: /http/, /example-com/, /2014/, and /05/, to give us a final cache path of:

wp-content/cache/quick-cache/cache/http/example-com/2014/05/

Note: Several special characters (such as periods) are replaced with hyphens when building the cache path, so example.com becomes example-com.)

The cache file for "Sample Post" is then written to a file called sample-post.html, where sample-post is the last portion of the URI.

We then end up with the following cache file:

wp-content/cache/quick-cache/cache/http/example-com/2014/05/sample-post.html

Quick Cache then loads and displays that cache file to each new visitor.


Further Reading

Something went wrong with that request. Please try again.