MidCOM Caching

From MidgardWiki

Jump to: navigation, search

MidCOM can cache a number of different types of objects in different ways. For example, data relevant to the MidCOM ACL system can be cached with memcached. Autogenerated MidCOM DBA classes can be cached in the phpscripts directory using for example DB4 handlers. Also, mechanisms exist to cache the actual content objects, but they depend on the MidCOM Components to invalidate the cache at the right time.

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

Cache 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_acl: If this is non-null and an array, MidCOM will create a memcached caching instance to buffer ACL reads from the DB. You set this parameter to the configuration array to use (use an empty array for the defaults). See the memcached backend for details.
  • 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. The defaults are to store all cache databases into the 'content/' subdirectory of the cache base directory, using the dba driver.
  • 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, prot and prefix. You should only change this if you run multiple MidCOM sites on the same host.
  • bool cache_module_content_multilang: Set this to true if you need a cache that honors the current client language. Set this to false, if you don't have a multilingual site and the language is fixed through a static $i18n->set_language call before code-init. This will improve the cache's performance.
  • 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: Valid values are
    'no-cache' activates no-cache mode that actively tries to circumvent all caching
    'revalidate' is the default which 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. The defaults are to store all cache databases into the 'nap/' subdirectory of the cache base directory, using the dba driver. The databases are named after the root topic guid, which should be sufficient in all cases. If you really want to separate things here, use different directories for the backends.
  • int cache_module_nap_metadata_cachesize: The number of Metadata objects that may be kept in memory simultaneously. Caching strategy is undefined at this time, it removes one randomly chosen element. Defaults to 75.
  • 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').
  • string cache_module_phpscripts_directory: The directory used for systemwide caching of PHP scripts (for example for the DBA intermediate classes or the component manifests).
Personal tools