\midcom_services_cache

This class is the central access point for all registered caching services. Currently this includes the NAP, Memcache, Content and PHPscripts cache databases.

The system is twofold:

There are cache backends, which are responsible for the actual storage and retrieval of cache information, and cache modules, which provide caching services to the application developer.

Check the documentation of the backends for configuring the cache on your live site (as an administrator).

Check the documentation of the cache modules to learn how to take advantage of the cache services available (as a component/core author).

The cache service is independent from the MidCOM Core, as it has to be started up at the beginning of the request. Cache modules are loaded on-demand.

This class will be available throughout he midcom service getter under the handle cache. The content cache module, for backwards compatibility, will be available as $midcom->cache.

All loaded modules will also be available as direct members of this class, you have to ensure the module is loaded in advance though. The class will automatically load all modules which are configured in the autoload_queue in the cache configuration.

Summary

Methods
Properties
Constants
__construct()
getSubscribedEvents()
handle_event()
handle_create()
handle_update()
shutdown()
load_module()
invalidate_all()
invalidate()
$content
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$_modules
$_unload_queue
N/A

Properties

$content

$content : \midcom_services_cache_module_content

Type

\midcom_services_cache_module_content

$_modules

$_modules : Array

List of all loaded modules, indexed by their class name.

Type

Array

$_unload_queue

$_unload_queue : Array

List of all modules in the order they need to be unloaded. This is a FILO queue, the module loaded first is unloaded last.

Type

Array

Methods

__construct()

__construct() 

Cache service startup. It initializes all cache modules configured in the global configuration as outlined in the class introduction.

It will load the content cache module as the first one, the rest will be loaded in their order of appearance in the Array.

getSubscribedEvents()

getSubscribedEvents() 

shutdown()

shutdown() 

Shuts all cache modules down. The content module is explicitly stopped as the last module for clear content cache handling (it might _midcom_stop_request()).

load_module()

load_module(string  $name) 

Load the specified cache module (if not already loaded), add it to the _modules array and assign it to a member variable named after the module.

Parameters

string $name

The name of the cache module to load.

invalidate_all()

invalidate_all() 

Invalidate all caches completely.

Use this, if you have, f.x. changes in the layout. The URL function midcom-cache-invalidate will trigger this function.

invalidate()

invalidate(mixed  $guid, string  $skip_module = '') 

Invalidates all cache records associated with a given content object.

Parameters

mixed $guid

This is either a GUID or a MidgardObject, in which case the Guid is auto-determined.

string $skip_module

If specified, the module mentioned here is skipped during invalidation. This option should be avoided by component authors at all costs, it is there for optimizations within the core cache modules (which sometimes need to invalidate only other modules, and invalidate themselves implicitly).