See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 403]
Cache definition class This file is part of Moodle's cache API, affectionately called MUC. It contains the components that are requried in order to use caching.
Copyright: | 2012 Sam Hemelryk |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1045 lines (39 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
cache_definition:: (1 method):
load()
file:: (0 methods):
file:: (0 methods):
does:: (40 methods):
load_adhoc()
get_cache_class()
get_id()
get_name()
get_mode()
get_area()
get_component()
uses_simple_keys()
get_identifiers()
get_ttl()
get_maxsize()
is_for_mappings_only()
uses_simple_data()
require_data_guarantee()
require_multiple_identifiers()
require_locking()
require_locking_read()
require_locking_write()
require_locking_before_write()
can_use_localstore()
require_searchable()
has_data_source()
get_data_source()
set_identifiers()
get_requirements_bin()
should_be_persistent()
use_static_acceleration()
get_persistent_max_size()
get_static_acceleration_size()
generate_definition_hash()
generate_single_key_prefix()
generate_multi_key_parts()
invalidates_on_event()
has_invalidation_events()
get_invalidation_events()
get_cache_identifier()
has_required_identifiers()
get_sharing_options()
get_user_input_sharing_key()
get_selected_sharing_option()
does:: (40 methods):
load_adhoc()
get_cache_class()
get_id()
get_name()
get_mode()
get_area()
get_component()
uses_simple_keys()
get_identifiers()
get_ttl()
get_maxsize()
is_for_mappings_only()
uses_simple_data()
require_data_guarantee()
require_multiple_identifiers()
require_locking()
require_locking_read()
require_locking_write()
require_locking_before_write()
can_use_localstore()
require_searchable()
has_data_source()
get_data_source()
set_identifiers()
get_requirements_bin()
should_be_persistent()
use_static_acceleration()
get_persistent_max_size()
get_static_acceleration_size()
generate_definition_hash()
generate_single_key_prefix()
generate_multi_key_parts()
invalidates_on_event()
has_invalidation_events()
get_invalidation_events()
get_cache_identifier()
has_required_identifiers()
get_sharing_options()
get_user_input_sharing_key()
get_selected_sharing_option()
file:: (0 methods):
does:: (40 methods):
load_adhoc()
get_cache_class()
get_id()
get_name()
get_mode()
get_area()
get_component()
uses_simple_keys()
get_identifiers()
get_ttl()
get_maxsize()
is_for_mappings_only()
uses_simple_data()
require_data_guarantee()
require_multiple_identifiers()
require_locking()
require_locking_read()
require_locking_write()
require_locking_before_write()
can_use_localstore()
require_searchable()
has_data_source()
get_data_source()
set_identifiers()
get_requirements_bin()
should_be_persistent()
use_static_acceleration()
get_persistent_max_size()
get_static_acceleration_size()
generate_definition_hash()
generate_single_key_prefix()
generate_multi_key_parts()
invalidates_on_event()
has_invalidation_events()
get_invalidation_events()
get_cache_identifier()
has_required_identifiers()
get_sharing_options()
get_user_input_sharing_key()
get_selected_sharing_option()
Class: cache_definition - X-Ref
The cache definition class.load($id, array $definition, $unused = null) X-Ref |
Creates a cache definition given a definition from the cache configuration or from a caches.php file. param: string $id param: array $definition param: string $unused Used to be datasourceaggregate but that was removed and this is now unused. return: cache_definition |
load_adhoc($mode, $component, $area, array $options = array() X-Ref |
Creates an ah-hoc cache definition given the required params. Please note that when using an adhoc definition you cannot set any of the optional params. This is because we cannot guarantee consistent access and we don't want to mislead people into thinking that. param: int $mode One of cache_store::MODE_* param: string $component The component this definition relates to. param: string $area The area this definition relates to. param: array $options An array of options, available options are: return: cache_application|cache_session|cache_request |
get_cache_class() X-Ref |
Returns the cache loader class that should be used for this definition. return: string |
get_id() X-Ref |
Returns the id of this definition. return: string |
get_name() X-Ref |
Returns the name for this definition return: string |
get_mode() X-Ref |
Returns the mode of this definition return: int One more cache_store::MODE_ |
get_area() X-Ref |
Returns the area this definition is associated with. return: string |
get_component() X-Ref |
Returns the component this definition is associated with. return: string |
uses_simple_keys() X-Ref |
Returns true if this definition is using simple keys. Simple keys contain only a-zA-Z0-9_ return: bool |
get_identifiers() X-Ref |
Returns the identifiers that are being used for this definition. return: array |
get_ttl() X-Ref |
Returns the ttl in seconds for this definition if there is one, or null if not. return: int|null |
get_maxsize() X-Ref |
Returns the maximum number of items allowed in this cache. return: int |
is_for_mappings_only() X-Ref |
Returns true if this definition should only be used with mappings. return: bool |
uses_simple_data() X-Ref |
Returns true if the data is known to be scalar or array of scalar. return: bool |
require_data_guarantee() X-Ref |
Returns true if this definition requires a data guarantee from the cache stores being used. return: bool |
require_multiple_identifiers() X-Ref |
Returns true if this definition requires that the cache stores support multiple identifiers return: bool |
require_locking() X-Ref |
Returns true if this definition requires locking functionality. Either read or write locking. return: bool |
require_locking_read() X-Ref |
Returns true if this definition requires read locking. return: bool |
require_locking_write() X-Ref |
Returns true if this definition requires write locking. return: bool |
require_locking_before_write() X-Ref |
Returns true if this definition requires a lock to be aquired before a write is attempted. return: bool |
can_use_localstore() X-Ref |
Returns true if this definition allows local storage to be used for caching. return: bool |
require_searchable() X-Ref |
Returns true if this definition requires a searchable cache. return: bool |
has_data_source() X-Ref |
Returns true if this definition has an associated data source. return: bool |
get_data_source() X-Ref |
Returns an instance of the data source class used for this definition. return: cache_data_source |
set_identifiers(array $identifiers = array() X-Ref |
Sets the identifiers for this definition, or updates them if they have already been set. param: array $identifiers return: bool false if no identifiers where changed, true otherwise. |
get_requirements_bin() X-Ref |
Returns the requirements of this definition as a binary flag. return: int |
should_be_persistent() X-Ref |
Please call {@link cache_definition::use_static_acceleration()} instead. |
use_static_acceleration() X-Ref |
Returns true if we should hold onto the data flowing through the cache. If set to true data flowing through the cache will be stored in a static variable to make subsequent requests for the data much faster. return: bool |
get_persistent_max_size() X-Ref |
Please call {@link cache_definition::get_static_acceleration_size()} instead. |
get_static_acceleration_size() X-Ref |
Returns the max size for the static acceleration array. return: int |
generate_definition_hash() X-Ref |
Generates a hash of this definition and returns it. return: string |
generate_single_key_prefix() X-Ref |
Generates a single key prefix for this definition return: string |
generate_multi_key_parts() X-Ref |
Generates a multi key prefix for this definition return: array |
invalidates_on_event($event) X-Ref |
Check if this definition should invalidate on the given event. param: string $event return: bool True if the definition should invalidate on the event. False otherwise. |
has_invalidation_events() X-Ref |
Check if the definition has any invalidation events. return: bool True if it does, false otherwise |
get_invalidation_events() X-Ref |
Returns all of the invalidation events for this definition. return: array |
get_cache_identifier() X-Ref |
Returns a cache identification string. return: string A string to be used as part of keys. |
has_required_identifiers() X-Ref |
Returns true if this definition requires identifiers. param: bool |
get_sharing_options() X-Ref |
Returns the possible sharing options that can be used with this defintion. return: int |
get_user_input_sharing_key() X-Ref |
Returns the user entered sharing key for this definition. return: string |
get_selected_sharing_option() X-Ref |
Returns the user selected sharing option for this definition. return: int |
load_adhoc($mode, $component, $area, array $options = array() X-Ref |
Creates an ah-hoc cache definition given the required params. Please note that when using an adhoc definition you cannot set any of the optional params. This is because we cannot guarantee consistent access and we don't want to mislead people into thinking that. param: int $mode One of cache_store::MODE_* param: string $component The component this definition relates to. param: string $area The area this definition relates to. param: array $options An array of options, available options are: return: cache_application|cache_session|cache_request |
get_cache_class() X-Ref |
Returns the cache loader class that should be used for this definition. return: string |
get_id() X-Ref |
Returns the id of this definition. return: string |
get_name() X-Ref |
Returns the name for this definition return: string |
get_mode() X-Ref |
Returns the mode of this definition return: int One more cache_store::MODE_ |
get_area() X-Ref |
Returns the area this definition is associated with. return: string |
get_component() X-Ref |
Returns the component this definition is associated with. return: string |
uses_simple_keys() X-Ref |
Returns true if this definition is using simple keys. Simple keys contain only a-zA-Z0-9_ return: bool |
get_identifiers() X-Ref |
Returns the identifiers that are being used for this definition. return: array |
get_ttl() X-Ref |
Returns the ttl in seconds for this definition if there is one, or null if not. return: int|null |
get_maxsize() X-Ref |
Returns the maximum number of items allowed in this cache. return: int |
is_for_mappings_only() X-Ref |
Returns true if this definition should only be used with mappings. return: bool |
uses_simple_data() X-Ref |
Returns true if the data is known to be scalar or array of scalar. return: bool |
require_data_guarantee() X-Ref |
Returns true if this definition requires a data guarantee from the cache stores being used. return: bool |
require_multiple_identifiers() X-Ref |
Returns true if this definition requires that the cache stores support multiple identifiers return: bool |
require_locking() X-Ref |
Returns true if this definition requires locking functionality. Either read or write locking. return: bool |
require_locking_read() X-Ref |
Returns true if this definition requires read locking. return: bool |
require_locking_write() X-Ref |
Returns true if this definition requires write locking. return: bool |
require_locking_before_write() X-Ref |
Returns true if this definition requires a lock to be aquired before a write is attempted. return: bool |
can_use_localstore() X-Ref |
Returns true if this definition allows local storage to be used for caching. return: bool |
require_searchable() X-Ref |
Returns true if this definition requires a searchable cache. return: bool |
has_data_source() X-Ref |
Returns true if this definition has an associated data source. return: bool |
get_data_source() X-Ref |
Returns an instance of the data source class used for this definition. return: cache_data_source |
set_identifiers(array $identifiers = array() X-Ref |
Sets the identifiers for this definition, or updates them if they have already been set. param: array $identifiers return: bool false if no identifiers where changed, true otherwise. |
get_requirements_bin() X-Ref |
Returns the requirements of this definition as a binary flag. return: int |
should_be_persistent() X-Ref |
Please call {@link cache_definition::use_static_acceleration()} instead. |
use_static_acceleration() X-Ref |
Returns true if we should hold onto the data flowing through the cache. If set to true data flowing through the cache will be stored in a static variable to make subsequent requests for the data much faster. return: bool |
get_persistent_max_size() X-Ref |
Please call {@link cache_definition::get_static_acceleration_size()} instead. |
get_static_acceleration_size() X-Ref |
Returns the max size for the static acceleration array. return: int |
generate_definition_hash() X-Ref |
Generates a hash of this definition and returns it. return: string |
generate_single_key_prefix() X-Ref |
Generates a single key prefix for this definition return: string |
generate_multi_key_parts() X-Ref |
Generates a multi key prefix for this definition return: array |
invalidates_on_event($event) X-Ref |
Check if this definition should invalidate on the given event. param: string $event return: bool True if the definition should invalidate on the event. False otherwise. |
has_invalidation_events() X-Ref |
Check if the definition has any invalidation events. return: bool True if it does, false otherwise |
get_invalidation_events() X-Ref |
Returns all of the invalidation events for this definition. return: array |
get_cache_identifier() X-Ref |
Returns a cache identification string. return: string A string to be used as part of keys. |
has_required_identifiers() X-Ref |
Returns true if this definition requires identifiers. param: bool |
get_sharing_options() X-Ref |
Returns the possible sharing options that can be used with this defintion. return: int |
get_user_input_sharing_key() X-Ref |
Returns the user entered sharing key for this definition. return: string |
get_selected_sharing_option() X-Ref |
Returns the user selected sharing option for this definition. return: int |
load_adhoc($mode, $component, $area, array $options = array() X-Ref |
Creates an ah-hoc cache definition given the required params. Please note that when using an adhoc definition you cannot set any of the optional params. This is because we cannot guarantee consistent access and we don't want to mislead people into thinking that. param: int $mode One of cache_store::MODE_* param: string $component The component this definition relates to. param: string $area The area this definition relates to. param: array $options An array of options, available options are: return: cache_application|cache_session|cache_request |
get_cache_class() X-Ref |
Returns the cache loader class that should be used for this definition. return: string |
get_id() X-Ref |
Returns the id of this definition. return: string |
get_name() X-Ref |
Returns the name for this definition return: string |
get_mode() X-Ref |
Returns the mode of this definition return: int One more cache_store::MODE_ |
get_area() X-Ref |
Returns the area this definition is associated with. return: string |
get_component() X-Ref |
Returns the component this definition is associated with. return: string |
uses_simple_keys() X-Ref |
Returns true if this definition is using simple keys. Simple keys contain only a-zA-Z0-9_ return: bool |
get_identifiers() X-Ref |
Returns the identifiers that are being used for this definition. return: array |
get_ttl() X-Ref |
Returns the ttl in seconds for this definition if there is one, or null if not. return: int|null |
get_maxsize() X-Ref |
Returns the maximum number of items allowed in this cache. return: int |
is_for_mappings_only() X-Ref |
Returns true if this definition should only be used with mappings. return: bool |
uses_simple_data() X-Ref |
Returns true if the data is known to be scalar or array of scalar. return: bool |
require_data_guarantee() X-Ref |
Returns true if this definition requires a data guarantee from the cache stores being used. return: bool |
require_multiple_identifiers() X-Ref |
Returns true if this definition requires that the cache stores support multiple identifiers return: bool |
require_locking() X-Ref |
Returns true if this definition requires locking functionality. Either read or write locking. return: bool |
require_locking_read() X-Ref |
Returns true if this definition requires read locking. return: bool |
require_locking_write() X-Ref |
Returns true if this definition requires write locking. return: bool |
require_locking_before_write() X-Ref |
Returns true if this definition requires a lock to be aquired before a write is attempted. return: bool |
can_use_localstore() X-Ref |
Returns true if this definition allows local storage to be used for caching. return: bool |
require_searchable() X-Ref |
Returns true if this definition requires a searchable cache. return: bool |
has_data_source() X-Ref |
Returns true if this definition has an associated data source. return: bool |
get_data_source() X-Ref |
Returns an instance of the data source class used for this definition. return: cache_data_source |
set_identifiers(array $identifiers = array() X-Ref |
Sets the identifiers for this definition, or updates them if they have already been set. param: array $identifiers return: bool false if no identifiers where changed, true otherwise. |
get_requirements_bin() X-Ref |
Returns the requirements of this definition as a binary flag. return: int |
should_be_persistent() X-Ref |
Please call {@link cache_definition::use_static_acceleration()} instead. |
use_static_acceleration() X-Ref |
Returns true if we should hold onto the data flowing through the cache. If set to true data flowing through the cache will be stored in a static variable to make subsequent requests for the data much faster. return: bool |
get_persistent_max_size() X-Ref |
Please call {@link cache_definition::get_static_acceleration_size()} instead. |
get_static_acceleration_size() X-Ref |
Returns the max size for the static acceleration array. return: int |
generate_definition_hash() X-Ref |
Generates a hash of this definition and returns it. return: string |
generate_single_key_prefix() X-Ref |
Generates a single key prefix for this definition return: string |
generate_multi_key_parts() X-Ref |
Generates a multi key prefix for this definition return: array |
invalidates_on_event($event) X-Ref |
Check if this definition should invalidate on the given event. param: string $event return: bool True if the definition should invalidate on the event. False otherwise. |
has_invalidation_events() X-Ref |
Check if the definition has any invalidation events. return: bool True if it does, false otherwise |
get_invalidation_events() X-Ref |
Returns all of the invalidation events for this definition. return: array |
get_cache_identifier() X-Ref |
Returns a cache identification string. return: string A string to be used as part of keys. |
has_required_identifiers() X-Ref |
Returns true if this definition requires identifiers. param: bool |
get_sharing_options() X-Ref |
Returns the possible sharing options that can be used with this defintion. return: int |
get_user_input_sharing_key() X-Ref |
Returns the user entered sharing key for this definition. return: string |
get_selected_sharing_option() X-Ref |
Returns the user selected sharing option for this definition. return: int |