APCu cache store main library.
Copyright: | 2012 Sam Hemelryk |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 412 lines (13 kb) |
Included or required: | 0 times |
Referenced: | 1 time |
Includes or requires: | 0 files |
cachestore_apcu:: (25 methods):
are_requirements_met()
is_supported_mode()
get_supported_features()
get_supported_modes()
__construct()
my_name()
initialise()
is_initialised()
prepare_key()
get()
get_many()
set()
set_many()
delete()
delete_many()
purge()
instance_deleted()
initialise_test_instance()
has()
has_any()
has_all()
unit_test_configuration()
config_get_configuration_array()
config_set_edit_form_data()
ready_to_be_used_for_testing()
Class: cachestore_apcu - X-Ref
The APCu cache store class.are_requirements_met() X-Ref |
Static method to check that the APCu stores requirements have been met. It checks that the APCu extension has been loaded and that it has been enabled. return: bool True if the stores software/hardware requirements have been met and it can be used. False otherwise. |
is_supported_mode($mode) X-Ref |
Static method to check if a store is usable with the given mode. return: bool True if the mode is supported. param: int $mode One of cache_store::MODE_* |
get_supported_features(array $configuration = array() X-Ref |
Returns the supported features as a binary flag. return: int The supported features. param: array $configuration The configuration of a store to consider specifically. |
get_supported_modes(array $configuration = array() X-Ref |
Returns the supported modes as a binary flag. return: int The supported modes. param: array $configuration The configuration of a store to consider specifically. |
__construct($name, array $configuration = array() X-Ref |
Constructs an instance of the cache store. This method should not create connections or perform and processing, it should be used param: string $name The name of the cache store param: array $configuration The configuration for this store instance. |
my_name() X-Ref |
Returns the name of this store instance. return: string |
initialise(cache_definition $definition) X-Ref |
Initialises a new instance of the cache store given the definition the instance is to be used for. This function should prepare any given connections etc. return: bool param: cache_definition $definition |
is_initialised() X-Ref |
Returns true if this cache store instance has been initialised. return: bool |
prepare_key($key) X-Ref |
Prepares the given key for use. Should be called before all interaction. return: string param: string $key The key to prepare for storing in APCu. |
get($key) X-Ref |
Retrieves an item from the cache store given its key. return: mixed The data that was associated with the key, or false if the key did not exist. param: string $key The key to retrieve |
get_many($keys) X-Ref |
Retrieves several items from the cache store in a single transaction. If not all of the items are available in the cache then the data value for those that are missing will be set to false. return: array An array of items from the cache. There will be an item for each key, those that were not in the store will param: array $keys The array of keys to retrieve |
set($key, $data) X-Ref |
Sets an item in the cache given its key and data value. return: bool True if the operation was a success false otherwise. param: string $key The key to use. param: mixed $data The data to set. |
set_many(array $keyvaluearray) X-Ref |
Sets many items in the cache in a single transaction. return: int The number of items successfully set. It is up to the developer to check this matches the number of items param: array $keyvaluearray An array of key value pairs. Each item in the array will be an associative array with two |
delete($key) X-Ref |
Deletes an item from the cache store. return: bool Returns true if the operation was a success, false otherwise. param: string $key The key to delete. |
delete_many(array $keys) X-Ref |
Deletes several keys from the cache in a single action. return: int The number of items successfully deleted. param: array $keys The keys to delete |
purge() X-Ref |
Purges the cache deleting all items within it. return: boolean True on success. False otherwise. |
instance_deleted() X-Ref |
Performs any necessary clean up when the store instance is being deleted. |
initialise_test_instance(cache_definition $definition) X-Ref |
Generates an instance of the cache store that can be used for testing. Returns an instance of the cache store, or false if one cannot be created. return: cache_store param: cache_definition $definition |
has($key) X-Ref |
Test is a cache has a key. return: bool True if the cache has the requested key, false otherwise. param: string|int $key |
has_any(array $keys) X-Ref |
Test if a cache has at least one of the given keys. return: bool True if the cache has at least one of the given keys param: array $keys |
has_all(array $keys) X-Ref |
Test is a cache has all of the given keys. return: bool True if the cache has all of the given keys, false otherwise. param: array $keys |
unit_test_configuration() X-Ref |
Generates the appropriate configuration required for unit testing. return: array Array of unit test configuration data to be used by initialise(). |
config_get_configuration_array($data) X-Ref |
Given the data from the add instance form this function creates a configuration array. return: array param: stdClass $data |
config_set_edit_form_data(moodleform $editform, array $config) X-Ref |
Allows the cache store to set its data against the edit form before it is shown to the user. param: moodleform $editform param: array $config |
ready_to_be_used_for_testing() X-Ref |
Returns true if this cache store instance is both suitable for testing, and ready for testing. Cache stores that support being used as the default store for unit and acceptance testing should override this function and return true if there requirements have been met. return: bool |