$_backends
$_backends : array<mixed,\Doctrine\Common\Cache\CacheProvider>
A list of all backends created by _create_backend(). They will be automatically shut down when the module shuts down. They are indexed by their name.
The Memory caching system is geared to hold needed information available quickly.
There are a number of limitations you have to deal with, when working with the Memory Cache.
Number One, you cannot put arbitrary keys into the cache. Since the memcached php extension does not support key listings, you are bound to use MidCOM object GUIDs as cache keys, whatever you do. To allow for different subsystems of the Framework to share the cache, I have introduce "Data groups", which are suffixes for the actual cache information. Thus, all keys in the cache follow a "{$datagroup}-{$guid}" naming scheme. These groups need to be registered in the MidCOM configuration key cache_module_memcache_data_groups.
Number Two, it is entirely possible (as it is the default), that the memcache is actually not available, as no memcache daemon has been found. This is controlled by the cache_module_memcache_backend configuration option, which tries to auto-detect a sensible default. If it is set to the name of a caching module it will actually start caching. Otherwise it will silently ignore put requests, and reports all keys as not existent.
Number Three, as at least memcache's contains() check isn't working on some machines, key values of false are forbidden, as they are used to check a keys existence during the get cycle. You should also avoid null and 0 members, if possible, they could naturally be error prone if you start forgetting about the typed comparisons.
Special functionality
put(string $data_group, string $key, mixed $data, integer $timeout)
Sets a given key in the cache. If the data group is unknown, a Warning-Level error is logged and putting is denied.
string | $data_group | The Data Group to look in. |
string | $key | The key to look up. |
mixed | $data | The data to store. |
integer | $timeout | how long the data should live in the cache. |
lookup_parent_data(string $guid) : array|false
This is a little helper that tries to look up a GUID in the memory cache's PARENT data group. If it is not found, false is returned.
If the object has no parent, the array value is null
string | $guid | The guid of which a parent is searched. |
The classname => GUID pair or false when nothing is in cache
update_parent_data(string $object_guid, array $parent_data)
This is a little helper that saves a parent GUID and class in the memory cache's PARENT data group.
string | $object_guid | The guid of which a parent is saved. |
array | $parent_data | The guid and classname of the parent which is saved. |
_create_backend(string $name, array $config) : \Doctrine\Common\Cache\CacheProvider
Creates an instance of the handler described by the configuration passed to the function.
The configuration array must include the configuration parameters driver and directory, as outlined in the midcom_services_cache_backend class documentation.
All backends will be collected in the $_backends array, indexed by their name.
Any duplicate instantiation will be intercepted, throwing a critical error.
string | $name | The name of the backend, must be unique throughout the system. |
array | $config | The configuration of the backend to create. It must contain the key 'driver', which indicates which backend to use. |
The new backend.