Using Split Level Caching

Using Split Level Caching

See also: Caching with Enfold Proxy and Caching Goals and Strategies.

With EP 7, Enfold Proxy supports split-view caching, a way to cache which avoids a common pitfall of caching servers.

What is split-level caching?

One important challenge in caching a page is how to tell the difference between content items visible to anonymous users and content items visible to an authenticated user. When the request header uses a vary tag, EP will check and compare both URL and the header(s) specified by the vary tag. Normally this value (called the cache key) will be sufficiently unique to the content item, but in some cases the cache key will be the same for two different content items. That phenomenon is called "split-views" because it means the caching server cannot manage both items simultaneously.

There are several methods for solving this problem. Enfold Proxy solves it by intercepting the request and dynamically adding a special X-Anonymous header to the anonymous request and then adding Vary:X-Anonymous to the split view response so that this header will be added to the cache key.

Enabling split-level caching in Plone

The Plone caching add ons can allow your site to do split-level caching. Consult the add-on's documentation for specific details. Note: after enabling it in Plone, you will also need to add a line to the eep.ini (see below).

With the plone.app.caching add-on (available for Plone 4), activating and controlling split-level caching is easy. After installing this Plone add-on, the Plone administrator can activate and control split-level caching via the plone.app.caching control panel in Plone Site Setup. Plone.app.caching has two proxy profiles: "With caching proxy" and "With caching proxy (and split-view caching)". Selecting the second option will be sufficient. Go to http://plone.org/products/plone.app.caching for more information.

In Plone 3, the caching add-on CacheFu can do split-level caching, but it requires more manual configuration. See the CacheFu documentation for details.

Enabling split-level caching in a proxy definition

(For tips on how to configure the eep.ini file, see Configuring EP manually).

After you have configured split-view caching with the Plone add-on, the next step is to add a line to the eep.ini file.

For example if your proxy definition looks like this:

[host myproxydefinition]
vh_hosts = 127.0.0.1:8080
vh_root = /Plone
lh_root = /
site = 1

You should add this extra line for Proxy to support split-level caching:

[host myproxydefinition]
vh_hosts = 127.0.0.1:8080
vh_root = /Plone
lh_root = /
site = 1
extension = ext_plone_content

You will need to do this for every proxy definition you want split-level caching to occur with.

Verifying that split-level caching is occuring

Generally, after you add this extra line to the eep.ini file, split-level caching will begin immediately.

You can verify this by consulting the logs in debug mode. You should see X-Anonymous or Set X-Anonymous throughout the logs whenever split level caching is occurring.