Caching

flack edited this page Dec 8, 2016 · 12 revisions

MidCOM's cache service consists of two principal modules, both of which can be accessed through the static accessor:

$cache = midcom::get()->cache;
// Content cache:
$cache->content->invalidate($guid);
// Memcache:
$cache->memcache->invalidate($guid);

memcache (which may or may not use Memcached as its backend) is a generic key => value store, which is used by a number of services, can be used in Components as well.

The content cache module acts more like a proxy, in that it captures and caches the rendered HTML for a page, so that it can serve it from cache instead of having the application render it over and over again.

The URL Method midcom-cache-invalidate can be used to force the regeneration of all caches.

Configuration

array cache_autoload_queue

The cache module loading queue during startup, you should normally have no need to change this (unless you want to add your own caching modules, in which case you have to ensure that the loading queue of MidCOM itself (as seen in this file) is not changed.

string cache_base_directory

The directory where to place cache files for MidCOM. This defaults to /tmp/ (note the trailing slash) as this is writable everywhere.

array cache_module_content_backend

The configuration of the content cache backend. Check the documentation of midcom_services_cache_backend of what options are available here. In general, you should use this only to change the backend driver. In all other cases you should leave this option untouched.

string cache_module_content_name

The identifier, the content cache should use for naming the files/directories it creates. This defaults to a string constructed out of the host's name, port and prefix. You should only change this if you run multiple sites on the same host.

bool cache_module_content_uncached

Set this to true if you want the site to run in an uncached mode. This is different from cache_disable in that the regular header preprocessing is done anyway, allowing for browser side caching. Essentially, the computing order is the same (no_cache for example is considered like usual), but the cache file is not stored. This defaults to false.

string cache_module_content_headers_strategy

  • 'no-cache' activates no-cache mode that actively tries to circumvent all caching
  • 'revalidate' (default) sets 'must-revalidate' and presses the issue by setting Expires to current time
  • 'public' and 'private' enable caching with the cache-control header of the same name, default expiry timestamps are generated using the cache_module_content_default_lifetime

int cache_module_content_default_lifetime

How many seconds from now to set the default Expires header to, defaults to one minute

array cache_module_nap_backend

The configuration of the nap/metadata cache backend. Check the documentation of midcom_services_cache_backend of what options are available here. In general, you should use this only to change the backend driver. In all other cases you should leave this option untouched.

string cache_module_memcache_backend

The cache backend to use for the memcache caching module. The default is null, which disables the module entirely. This is the default. If you have both memcached and the memcache PHP extension installed, set this to 'memcached', to enable the cache.

array cache_module_memcache_backend_config

The backend configuration to use if a backend was specified. See the individual backend documentations for more information about the allowed option set. This defaults to an empty array.

array cache_module_memcache_data_groups

The data groups avaialable for the memcache module. You should normally not have to touch this, see the memcache module documentation for details. This defaults to Array('ACL', 'PARENT', 'L10N', 'MISC').

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.