Plugins::pageCache

From ZenMagick Wiki

(Redirected from Plugins::zm page cache)
Jump to: navigation, search

Description

A file based caching service.

Depending on certain criteria the plugin determines whether a particular page qualifies for caching or not. Mostly, this is centered around the question of whether there is customer specific data on the page or not. Examples could be shopping cart content, the customer being logged in, etc.

If a page qualifies for caching, the plugin will check for an existing valid cache entry. If one is found, the cached HTML is returned. If no cache entry is found, the page request is processed normally. The final HTML is then taken and stored in the cache to be used for future requests to the same URL.

Configuration

The plugin can be configured via ZenMagick settings. In particular, the following settings can be used to tweak the behavior:

plugins.zm_page_cache.stats
Values: [true|false]
Default: true
Description: Enables / disables appending hidden stats (as HTML comments) (request/cache) to the response.
plugins.zm_page_cache.ttl
Values: time in seconds
Default: 300
Description: The time-to-live (in seconds) before a cache entry expires.
plugins.zm_page_cache.strategy.callback
Value: [function name]
Default: zm_page_cache_default_strategy
Description: The value is taken as function name to determine whether the current request is cacheable or not. A return value of [true] indicates that the current request is cacheable.
plugins.zm_page_cache.strategy.allowed
Values: [array|comma separated string]
Default: value of ZM_PLUGINS_PAGE_CACHE_ALLOWED_DEFAULT
Description: List of page names (the main_page value) that qualify for caching (unless prohibited by other criteria like login status, cart status, etc).

Notes

The plugin has a default sort order of 9999 to make this the last plugin to execute. If this is not the case there might be a chance that other plugins manipulate the final response after the HTML has been stored in the cache. In that case, subsequent requests will get a reponse with those modifications missing.

Personal tools