purge_all() and purge_by_definition() look in the configuration
for which caches are available and then creates them to purge them.
The configuration stores the values used by initialise(), not
initialise_unit_test_instance() and would therefore fail to purge
all caches if they were not purged by another means.
In the case of filestore, it's purged by unit tests, in the case
of memcache(d), it purges the whole store when a single definition
is requested.
Therefore all configuration was moved into the configuration file
during unit tests and does not have any special override codes in
the unit test infrastructure.
This code was originally taken from; https://github.com/durana/moodle-cachestore_redis
Special thanks to Mark Nielsen and Adam Durana for their work on this.
Since the original import;
- Mode session support has been added.
- Some cleanup of names has been made.
- Data guarantee and references support was added.
Static cache has a very flexible storage capability
and does not need all the checks performed on it.
Enabling dereferencing handling and multiple identifiers
removes a lot of unneeded overhead for request caches that
have many get calls.
The changes were modelled on the static acceleration changes
done in MDL-53208.
When a cachable object is store in the static cache from
the backing store, it was incorrect serialised rather than
using the wake function. This has been resolved and tests added.
During the investigation into cacheable_object, it was discovered
that set_identifiers never removes identifiers when you call it,
so set_identifiers(array('a')) and set_identifiers(array('b')) really
resulted in array('a','b') as the identifiers rather than 'b'.
The fix for this issue depends on the set_identifiers fix and
they have been coupled together as a result.
When added a memcached instance you can now select whether the cache is
being shared by other applications. The setting will determine the
purging strategy.
Shared caches will have individual keys deleted while dedicated caches
will have the entire cache purged (better performance over networks).
Note: This option only works with the correct version of the php
memcached extension and with the multi-site safe changes.
- We only now serialize when required, eg when the store doesn't do it.
- static acceleration now serializes on set to reduce overhead on load.
- null now works in static acceleration as we use an array for storage metadata
- static acceleration delete uses isset rather than an array_search.
- We only now serialize when required, eg when the store doesn't do it.
- static acceleration now serializes on set to reduce overhead on load.
- null now works in static acceleration as we use an array for storage metadata
- static acceleration delete uses isset rather than an array_search.
If the cache does all the dereferencing when it stores and loads
the objects, then the cache loaders don't need to do that work.
This is true of all caches that use something other than PHP's memory
to store their results.