Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Public Member Functions | |
can_use_localstore () | |
Returns true if this definition allows local storage to be used for caching. More... | |
generate_definition_hash () | |
Generates a hash of this definition and returns it. More... | |
generate_multi_key_parts () | |
Generates a multi key prefix for this definition. More... | |
generate_single_key_prefix () | |
Generates a single key prefix for this definition. More... | |
get_area () | |
Returns the area this definition is associated with. More... | |
get_cache_class () | |
Returns the cache loader class that should be used for this definition. More... | |
get_component () | |
Returns the component this definition is associated with. More... | |
get_data_source () | |
Returns an instance of the data source class used for this definition. More... | |
get_id () | |
Returns the id of this definition. More... | |
get_identifiers () | |
Returns the identifiers that are being used for this definition. More... | |
get_invalidation_events () | |
Returns all of the invalidation events for this definition. More... | |
get_maxsize () | |
Returns the maximum number of items allowed in this cache. More... | |
get_mode () | |
Returns the mode of this definition. More... | |
get_name () | |
Returns the name for this definition. More... | |
get_persistent_max_size () | |
Please call cache_definition::get_static_acceleration_size() instead. More... | |
get_requirements_bin () | |
Returns the requirements of this definition as a binary flag. More... | |
get_selected_sharing_option () | |
Returns the user selected sharing option for this definition. More... | |
get_sharing_options () | |
Returns the possible sharing options that can be used with this defintion. More... | |
get_static_acceleration_size () | |
Returns the max size for the static acceleration array. More... | |
get_ttl () | |
Returns the ttl in seconds for this definition if there is one, or null if not. More... | |
get_user_input_sharing_key () | |
Returns the user entered sharing key for this definition. More... | |
has_data_source () | |
Returns true if this definition has an associated data source. More... | |
has_invalidation_events () | |
Check if the definition has any invalidation events. More... | |
has_required_identifiers () | |
Returns true if this definition requires identifiers. More... | |
invalidates_on_event ($event) | |
Check if this definition should invalidate on the given event. More... | |
is_for_mappings_only () | |
Returns true if this definition should only be used with mappings. More... | |
require_data_guarantee () | |
Returns true if this definition requires a data guarantee from the cache stores being used. More... | |
require_locking () | |
Returns true if this definition requires locking functionality. More... | |
require_locking_read () | |
Returns true if this definition requires read locking. More... | |
require_locking_write () | |
Returns true if this definition requires write locking. More... | |
require_multiple_identifiers () | |
Returns true if this definition requires that the cache stores support multiple identifiers. More... | |
require_searchable () | |
Returns true if this definition requires a searchable cache. More... | |
set_identifiers (array $identifiers=array()) | |
Sets the identifiers for this definition, or updates them if they have already been set. More... | |
should_be_persistent () | |
Please call cache_definition::use_static_acceleration() instead. More... | |
use_static_acceleration () | |
Returns true if we should hold onto the data flowing through the cache. More... | |
uses_simple_data () | |
Returns true if the data is known to be scalar or array of scalar. More... | |
uses_simple_keys () | |
Returns true if this definition is using simple keys. More... | |
Static Public Member Functions | |
static | load ($id, array $definition, $unused=null) |
Creates a cache definition given a definition from the cache configuration or from a caches.php file. More... | |
static | load_adhoc ($mode, $component, $area, array $options=array()) |
Creates an ah-hoc cache definition given the required params. More... | |
Public Attributes | |
const | SHARING_ALL = 1 |
The cache can be shared with everyone. | |
const | SHARING_DEFAULT = 2 |
The default sharing option that gets used if none have been selected. More... | |
const | SHARING_DEFAULTOPTIONS = 15 |
The default sharing options available. More... | |
const | SHARING_INPUT = 8 |
The cache can be shared with other sites using the same key. | |
const | SHARING_SITEID = 2 |
The cache can be shared with other sites using the same siteid. | |
const | SHARING_VERSION = 4 |
The cache can be shared with other sites of the same version. | |
Protected Member Functions | |
get_cache_identifier () | |
Returns a cache identification string. More... | |
Protected Attributes | |
string | $area |
The area this definition is associated with. | |
bool | $canuselocalstore = false |
Whether this cache supports local storages. | |
string | $component |
The component this definition is associated with. | |
string | $datasource = null |
The data source class to use with this definition. | |
string | $datasourcefile = null |
The file in which the data source class exists. More... | |
string | $definitionhash = null |
A hash identifier of this definition. | |
string | $id |
The identifier for the definition. | |
array | $identifiers = null |
An array of identifiers provided to this cache when it was initialised. | |
array | $invalidationevents = array() |
An array of events that should cause this cache to invalidate. | |
array | $keyprefixmulti = null |
Key prefix to use with cache stores that support multi keys. | |
string | $keyprefixsingle = null |
Key prefix for use with single key cache stores. | |
bool | $mappingsonly = false |
Set to true if this cache should only use mapped cache stores and not the default mode cache store. | |
int | $maxsize = null |
Sets the maximum number of items that can exist in the cache. More... | |
int | $mode |
The mode for the defintion. More... | |
string | $overrideclass = null |
The class to use as the cache loader for this definition. | |
string | $overrideclassfile = null |
The file in which the override class exists. More... | |
bool | $requiredataguarantee = false |
If set to true then only stores that guarantee data may be used with this definition. | |
array | $requireidentifiers = array() |
An array of identifiers that must be provided when the definition is used to create a cache. | |
bool | $requirelocking = false |
If set to true then we know that this definition requires the locking functionality. More... | |
bool | $requirelockingread = false |
Set to true if this definition requires read locking. | |
bool | $requirelockingwrite = false |
Gets set to true if this definition requires write locking. | |
bool | $requiremultipleidentifiers = false |
If set to true then only stores that support multple identifiers may be used with this definition. | |
bool | $requiresearchable = false |
Gets set to true if this definition requires searchable stores. More... | |
int | $selectedsharingoption = self::SHARING_DEFAULT |
The selected sharing option. More... | |
int | $sharingoptions |
The selected sharing mode for this definition. | |
bool | $simpledata = false |
Set to true if we know the data is scalar or array of scalar. | |
bool | $simplekeys = false |
If set to true we know the keys are simple. More... | |
bool | $staticacceleration = false |
Set to true if the cache should hold onto items passing through it to speed up subsequent requests. | |
int | $staticaccelerationsize = false |
The maximum number of items that static acceleration cache should hold onto. | |
int | $ttl = 0 |
The TTL for data in this cache. More... | |
string | $userinputsharingkey = '' |
The user input key to use if the SHARING_INPUT option has been selected. More... | |
cache_definition::can_use_localstore | ( | ) |
Returns true if this definition allows local storage to be used for caching.
bool |
cache_definition::generate_definition_hash | ( | ) |
Generates a hash of this definition and returns it.
string |
cache_definition::generate_multi_key_parts | ( | ) |
Generates a multi key prefix for this definition.
array |
cache_definition::generate_single_key_prefix | ( | ) |
Generates a single key prefix for this definition.
string |
cache_definition::get_area | ( | ) |
Returns the area this definition is associated with.
string |
cache_definition::get_cache_class | ( | ) |
Returns the cache loader class that should be used for this definition.
string |
|
protected |
Returns a cache identification string.
string | A string to be used as part of keys. |
cache_definition::get_component | ( | ) |
Returns the component this definition is associated with.
string |
cache_definition::get_data_source | ( | ) |
Returns an instance of the data source class used for this definition.
cache_data_source |
coding_exception |
cache_definition::get_id | ( | ) |
Returns the id of this definition.
string |
cache_definition::get_identifiers | ( | ) |
Returns the identifiers that are being used for this definition.
array |
cache_definition::get_invalidation_events | ( | ) |
Returns all of the invalidation events for this definition.
array |
cache_definition::get_maxsize | ( | ) |
Returns the maximum number of items allowed in this cache.
int |
cache_definition::get_mode | ( | ) |
Returns the mode of this definition.
int | One more cache_store::MODE_ |
cache_definition::get_name | ( | ) |
Returns the name for this definition.
string |
cache_definition::get_persistent_max_size | ( | ) |
Please call cache_definition::get_static_acceleration_size() instead.
cache_definition::get_requirements_bin | ( | ) |
Returns the requirements of this definition as a binary flag.
int |
cache_definition::get_selected_sharing_option | ( | ) |
Returns the user selected sharing option for this definition.
int |
cache_definition::get_sharing_options | ( | ) |
Returns the possible sharing options that can be used with this defintion.
int |
cache_definition::get_static_acceleration_size | ( | ) |
Returns the max size for the static acceleration array.
int |
cache_definition::get_ttl | ( | ) |
Returns the ttl in seconds for this definition if there is one, or null if not.
int|null |
cache_definition::get_user_input_sharing_key | ( | ) |
Returns the user entered sharing key for this definition.
string |
cache_definition::has_data_source | ( | ) |
Returns true if this definition has an associated data source.
bool |
cache_definition::has_invalidation_events | ( | ) |
Check if the definition has any invalidation events.
bool | True if it does, false otherwise |
cache_definition::has_required_identifiers | ( | ) |
Returns true if this definition requires identifiers.
bool |
cache_definition::invalidates_on_event | ( | $event | ) |
Check if this definition should invalidate on the given event.
string | $event |
bool | True if the definition should invalidate on the event. False otherwise. |
cache_definition::is_for_mappings_only | ( | ) |
Returns true if this definition should only be used with mappings.
bool |
|
static |
Creates a cache definition given a definition from the cache configuration or from a caches.php file.
string | $id | |
array | $definition | |
string | $unused | Used to be datasourceaggregate but that was removed and this is now unused. |
cache_definition |
coding_exception |
|
static |
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.
int | $mode | One of cache_store::MODE_* |
string | $component | The component this definition relates to. |
string | $area | The area this definition relates to. |
array | $options | An array of options, available options are:
|
cache_application|cache_session|cache_request |
cache_definition::require_data_guarantee | ( | ) |
Returns true if this definition requires a data guarantee from the cache stores being used.
bool |
cache_definition::require_locking | ( | ) |
Returns true if this definition requires locking functionality.
Either read or write locking.
bool |
cache_definition::require_locking_read | ( | ) |
Returns true if this definition requires read locking.
bool |
cache_definition::require_locking_write | ( | ) |
Returns true if this definition requires write locking.
bool |
cache_definition::require_multiple_identifiers | ( | ) |
Returns true if this definition requires that the cache stores support multiple identifiers.
bool |
cache_definition::require_searchable | ( | ) |
Returns true if this definition requires a searchable cache.
bool |
cache_definition::set_identifiers | ( | array | $identifiers = array() | ) |
Sets the identifiers for this definition, or updates them if they have already been set.
array | $identifiers |
bool | false if no identifiers where changed, true otherwise. |
coding_exception |
cache_definition::should_be_persistent | ( | ) |
Please call cache_definition::use_static_acceleration() instead.
cache_definition::use_static_acceleration | ( | ) |
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.
bool |
cache_definition::uses_simple_data | ( | ) |
Returns true if the data is known to be scalar or array of scalar.
bool |
cache_definition::uses_simple_keys | ( | ) |
Returns true if this definition is using simple keys.
Simple keys contain only a-zA-Z0-9_
bool |
|
protected |
The file in which the data source class exists.
This will be included if required.
|
protected |
Sets the maximum number of items that can exist in the cache.
Please note this isn't a hard limit, and doesn't need to be enforced by the caches. They can choose to do so optionally.
|
protected |
The mode for the defintion.
One of cache_store::MODE_*
|
protected |
The file in which the override class exists.
This will be included if required. Absolute path
|
protected |
If set to true then we know that this definition requires the locking functionality.
This gets set during construction based upon the settings requirelockingread and requirelockingwrite.
|
protected |
Gets set to true if this definition requires searchable stores.
|
protected |
The selected sharing option.
One of self::SHARING_*
|
protected |
If set to true we know the keys are simple.
a-zA-Z0-9_
|
protected |
The TTL for data in this cache.
Please don't use this, instead use event driven invalidation.
|
protected |
The user input key to use if the SHARING_INPUT option has been selected.
Must be ALPHANUMEXT
const cache_definition::SHARING_DEFAULT = 2 |
The default sharing option that gets used if none have been selected.
SiteID. It is the most restrictive.
const cache_definition::SHARING_DEFAULTOPTIONS = 15 |
The default sharing options available.
All + SiteID + Version + Input.