Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
cache_session Class Reference

A session cache. More...

Inheritance diagram for cache_session:
cache cache_loader

Public Member Functions

 __construct (cache_definition $definition, cache_store $store, $loader=null)
 Override the cache\construct method.
 
 delete ($key, $recurse=true)
 Delete the given key from the cache.
 
 delete_many (array $keys, $recurse=true)
 Delete all of the given keys from the cache.
 
 get ($key, $strictness=IGNORE_MISSING)
 Retrieves the value for the given key from the cache.
 
 get_many (array $keys, $strictness=IGNORE_MISSING)
 Retrieves an array of values for an array of keys.
 
 get_versioned ($key, int $requiredversion, int $strictness=IGNORE_MISSING, &$actualversion=null)
 Retrieves the value and actual version for the given key, with at least the required version.
 
 has ($key)
 Test is a cache has a key.
 
 has ($key, $tryloadifpossible=false)
 Test is a cache has a key.
 
 has_all (array $keys)
 Test is a cache has all of the given keys.
 
 has_any (array $keys)
 Test if a cache has at least one of the given keys.
 
 purge ()
 Purges the cache store, and loader if there is one.
 
 purge_current_user ()
 Purges the session cache of all data belonging to the current user.
 
 set ($key, $data)
 Sends a key => value pair to the cache.
 
 set_identifiers (array $identifiers)
 Alters the identifiers that have been provided to the definition.
 
 set_many (array $keyvaluearray)
 Sends several key => value pairs to the cache.
 
 set_versioned ($key, int $version, $data)
 Sets the value for the given key with the given version.
 

Static Public Member Functions

static compare_purge_tokens ($tokena, $tokenb)
 Compare a pair of purge tokens.
 
static get_purge_token ($reset=false)
 Get a 'purge' token used for cache invalidation handling.
 
static make ($component, $area, array $identifiers=array(), $unused=null)
 Creates a new cache instance for a pre-defined definition.
 
static make_from_params ($mode, $component, $area, array $identifiers=array(), array $options=array())
 Creates a new cache instance based upon the given params.
 
static now ($float=false)
 Returns the timestamp from the first request for the time from the cache API.
 

Public Attributes

const KEY_PREFIX = 'sess_'
 Constant used to prefix keys.
 
const LASTACCESS = '__lastaccess__'
 This is the key used to track last access.
 
int const VERSION_NONE = -1
 Constant for cache entries that do not have a version number.
 

Protected Member Functions

 check_tracked_user ()
 Check that this cache instance is tracking the current user.
 
 deep_clone ($value)
 Creates a reference free clone of the given value.
 
 delete_from_persist_cache ()
 
 get_datasource ()
 Returns the data source associated with this cache.
 
 get_definition ()
 Returns the cache definition.
 
 get_from_persist_cache ()
 
 get_implementation ($key, int $requiredversion, int $strictness, &$actualversion=null)
 Retrieves the value for the given key from the cache.
 
 get_key_prefix ()
 Returns the prefix used for all keys.
 
 get_loader ()
 Returns the loader associated with this instance.
 
 get_store ()
 Returns the cache store.
 
 handle_invalidation_events ()
 Process any outstanding invalidation events for the cache we are registering,.
 
 has_a_ttl ()
 Returns true if the cache is making use of a ttl.
 
 is_in_persist_cache ()
 
 is_using_persist_cache ()
 
 parse_key ($key)
 Parses the key turning it into a string (or array is required) suitable to be passed to the cache store.
 
 requires_serialisation ($value, $depth=1)
 Checks to see if a var requires serialisation.
 
 set_data_source (cache_data_source $datasource)
 Set the data source for this cache.
 
 set_implementation ($key, int $version, $data, bool $setparents=true)
 Sets the value for the given key, optionally with a version tag.
 
 set_in_persist_cache ()
 
 set_is_sub_loader ($setting=true)
 Used to inform the loader of its state as a sub loader, or as the top of the chain.
 
 set_loader (cache_loader $loader)
 Set the loader for this cache.
 
 set_session_id ()
 Sets the session id for the loader.
 
 static_acceleration_delete ($key)
 Deletes an item from the static acceleration array.
 
 static_acceleration_get ($key)
 Returns the item from the static acceleration array if it exists there.
 
 static_acceleration_has ($key)
 Returns true if the requested key exists within the static acceleration array.
 
 static_acceleration_purge ()
 Purge the static acceleration cache.
 
 static_acceleration_set ($key, $data)
 Sets a key value pair into the static acceleration array.
 
 store_supports_key_awareness ()
 Returns true if the store supports key awareness.
 
 store_supports_native_locking ()
 Returns true if the store natively supports locking.
 
 store_supports_native_ttl ()
 Returns true if the cache store supports native ttl.
 
 unref ($data)
 Removes references where required.
 
 use_static_acceleration ()
 The session loader never uses static acceleration.
 

Static Protected Member Functions

static check_version ($result, int $requiredversion)
 Checks returned data to see if it matches the specified version number.
 

Protected Attributes

int $currentuserid = null
 The userid this cache is currently using.
 
cache_store null $nativelocking = null
 Gets set to true if the cache's primary store natively supports locking.
 
bool $perfdebug = false
 Gets set to true if we want to collect performance information about the cache API.
 
bool $requirelockingbeforewrite = false
 Gets set to true if the cache writes (set|delete) must have a manual lock created first.
 
array $session = null
 The session data for the above session id.
 
array $sessionid = null
 The session id we are currently using.
 
strubg $storetype = 'unknown'
 Gets set to the class name of the store during initialisation.
 
bool $subloader = false
 Determines if this loader is a sub loader, not the top of the chain.
 

Static Protected Attributes

static int $loadeduserid = null
 The user the session has been established for.
 
static int $now
 We need a timestamp to use within the cache API.
 
static string $purgetoken
 A purge token used to distinguish between multiple cache purges in the same second.
 

Detailed Description

A session cache.

This class is used for session caches returned by the cache\make methods.

It differs from the application loader in a couple of noteable ways:

  1. Sessions are always expected to exist. Because of this we don't ever use the static acceleration array.
  2. Session data for a loader instance (store + definition) is consolidate into a single array for storage within the store. Along with this we embed a lastaccessed time with the data. This way we can check sessions for a last access time.
  3. Session stores are required to support key searching and must implement cache_is_searchable. This ensures stores used for the cache can be targetted for garbage collection of session data.

This cache class should never be interacted with directly. Instead you should always use the cache\make methods. It is technically possible to call those methods through this class however there is no guarantee that you will get an instance of this class back again.

Todo
we should support locking in the session as well. Should be pretty simple to set up.

Constructor & Destructor Documentation

◆ __construct()

cache_session::__construct ( cache_definition $definition,
cache_store $store,
$loader = null )

Override the cache\construct method.

This function gets overriden so that we can process any invalidation events if need be. If the definition doesn't have any invalidation events then this occurs exactly as it would for the cache class. Otherwise we look at the last invalidation time and then check the invalidation data for events that have occured between then now.

You should not call this method from your code, instead you should use the cache\make methods.

Parameters
cache_definition$definition
cache_store$store
cache_loader | cache_data_source$loader

Reimplemented from cache.

Member Function Documentation

◆ check_version()

static cache::check_version ( $result,
int $requiredversion )
staticprotectedinherited

Checks returned data to see if it matches the specified version number.

For versioned data, this returns the version_wrapper object (or false). For other data, it returns the actual data (or false).

Parameters
mixed$resultResult data
int$requiredversionRequired version number or VERSION_NONE if there must be no version
Return values
boolTrue if version is current, false if not (or if result is false)
Exceptions
coding_exceptionIf unexpected type of data (versioned vs non-versioned) is found

◆ compare_purge_tokens()

static cache::compare_purge_tokens ( $tokena,
$tokenb )
staticinherited

Compare a pair of purge tokens.

If the two tokens are identical, then the return value is 0. If the time component of token A is newer than token B, then a positive value is returned. If the time component of token B is newer than token A, then a negative value is returned.

Note: This function is intended for use from within the Cache API only and not by plugins, or cache stores.

Parameters
string$tokena
string$tokenb
Return values
int

◆ deep_clone()

cache::deep_clone ( $value)
protectedinherited

Creates a reference free clone of the given value.

Parameters
mixed$value
Return values
mixed

◆ delete()

cache_session::delete ( $key,
$recurse = true )

Delete the given key from the cache.

Parameters
string | int$keyThe key to delete.
bool$recurseWhen set to true the key will also be deleted from all stacked cache loaders and their stores. This happens by default and ensure that all the caches are consistent. It is NOT recommended to change this.
Return values
boolTrue of success, false otherwise.

Reimplemented from cache.

◆ delete_from_persist_cache()

cache::delete_from_persist_cache ( )
protectedinherited
Deprecated
since 2.6
See also
cache\static_acceleration_delete()

◆ delete_many()

cache_session::delete_many ( array $keys,
$recurse = true )

Delete all of the given keys from the cache.

Parameters
array$keysThe key to delete.
bool$recurseWhen set to true the key will also be deleted from all stacked cache loaders and their stores. This happens by default and ensure that all the caches are consistent. It is NOT recommended to change this.
Return values
intThe number of items successfully deleted.

Reimplemented from cache.

◆ get()

cache::get ( $key,
$strictness = IGNORE_MISSING )
inherited

Retrieves the value for the given key from the cache.

Parameters
string | int$keyThe key for the data being requested. It can be any structure although using a scalar string or int is recommended in the interests of performance. In advanced cases an array may be useful such as in situations requiring the multi-key functionality.
int$strictnessOne of IGNORE_MISSING | MUST_EXIST
Return values
mixed|falseThe data from the cache or false if the key did not exist within the cache.
Exceptions
coding_exception

Implements cache_loader.

◆ get_datasource()

cache::get_datasource ( )
protectedinherited

Returns the data source associated with this cache.

Since
Moodle 2.4.4
Return values
cache_data_source|false

◆ get_definition()

cache::get_definition ( )
protectedinherited

Returns the cache definition.

Return values
cache_definition

◆ get_from_persist_cache()

cache::get_from_persist_cache ( )
protectedinherited
Deprecated
since 2.6
See also
cache\static_acceleration_get

◆ get_implementation()

cache_session::get_implementation ( $key,
int $requiredversion,
int $strictness,
& $actualversion = null )
protected

Retrieves the value for the given key from the cache.

Parameters
string | int$keyThe key for the data being requested. It can be any structure although using a scalar string or int is recommended in the interests of performance. In advanced cases an array may be useful such as in situations requiring the multi-key functionality.
int$requiredversionMinimum required version of the data or cache\VERSION_NONE
int$strictnessOne of IGNORE_MISSING | MUST_EXIST
mixed&$actualversionIf specified, will be set to the actual version number retrieved
Return values
mixed|falseThe data from the cache or false if the key did not exist within the cache.
Exceptions
coding_exception

Reimplemented from cache.

◆ get_key_prefix()

cache_session::get_key_prefix ( )
protected

Returns the prefix used for all keys.

Return values
string

◆ get_loader()

cache::get_loader ( )
protectedinherited

Returns the loader associated with this instance.

Since
Moodle 2.4.4
Return values
cache|false

◆ get_many()

cache_session::get_many ( array $keys,
$strictness = IGNORE_MISSING )

Retrieves an array of values for an array of keys.

Using this function comes with potential performance implications. Not all cache stores will support get_many/set_many operations and in order to replicate this functionality will call the equivalent singular method for each item provided. This should not deter you from using this function as there is a performance benefit in situations where the cache store does support it, but you should be aware of this fact.

Parameters
array$keysThe keys of the data being requested. Each key can be any structure although using a scalar string or int is recommended in the interests of performance. In advanced cases an array may be useful such as in situations requiring the multi-key functionality.
int$strictnessOne of IGNORE_MISSING or MUST_EXIST.
Return values
arrayAn array of key value pairs for the items that could be retrieved from the cache. If MUST_EXIST was used and not all keys existed within the cache then an exception will be thrown. Otherwise any key that did not exist will have a data value of false within the results.
Exceptions
coding_exception

Reimplemented from cache.

◆ get_purge_token()

static cache::get_purge_token ( $reset = false)
staticinherited

Get a 'purge' token used for cache invalidation handling.

Note: This function is intended for use from within the Cache API only and not by plugins, or cache stores.

Parameters
bool$resetWhether to reset the token and generate a new one.
Return values
string

◆ get_store()

cache::get_store ( )
protectedinherited

Returns the cache store.

Return values
cache_store

◆ get_versioned()

cache::get_versioned ( $key,
int $requiredversion,
int $strictness = IGNORE_MISSING,
& $actualversion = null )
inherited

Retrieves the value and actual version for the given key, with at least the required version.

If there is no value for the key, or there is a value but it doesn't have the required version, then this function will return null (or throw an exception if you set strictness to MUST_EXIST).

This function can be used to make it easier to support localisable caches (where the cache could be stored on a local server as well as a shared cache). Specifying the version means that it will automatically retrieve the correct version if available, either from the local server or [if that has an older version] from the shared server.

If the cached version is newer than specified version, it will be returned regardless. For example, if you request version 4, but the locally cached version is 5, it will be returned. If you request version 6, and the locally cached version is 5, then the system will look in higher-level caches (if any); if there still isn't a version 6 or greater, it will return null.

You must use this function if you use set_versioned.

Parameters
string | int$keyThe key for the data being requested.
int$requiredversionMinimum required version of the data
int$strictnessOne of IGNORE_MISSING or MUST_EXIST.
mixed$actualversionIf specified, will be set to the actual version number retrieved
Return values
mixedData from the cache, or false if the key did not exist or was too old
Exceptions
coding_exceptionIf you call get_versioned on a non-versioned cache key

Implements cache_loader.

◆ handle_invalidation_events()

cache::handle_invalidation_events ( )
protectedinherited

Process any outstanding invalidation events for the cache we are registering,.

Identifiers and event invalidation are not compatible with each other at this time. As a result the cache does not need to consider identifiers when working out what to invalidate.

◆ has() [1/2]

cache_loader::has ( $key)
inherited

Test is a cache has a key.

The use of the has methods is strongly discouraged. In a high load environment the cache may well change between the test and any subsequent action (get, set, delete etc). Instead it is recommended to write your code in such a way they it performs the following steps:

  1. Attempt to retrieve the information.
  2. Generate the information.
  3. Attempt to set the information

Its also worth mentioning that not all stores support key tests. For stores that don't support key tests this functionality is mimicked by using the equivalent get method. Just one more reason you should not use these methods unless you have a very good reason to do so.

Parameters
string | int$key
Return values
boolTrue if the cache has the requested key, false otherwise.

◆ has() [2/2]

cache_session::has ( $key,
$tryloadifpossible = false )

Test is a cache has a key.

The use of the has methods is strongly discouraged. In a high load environment the cache may well change between the test and any subsequent action (get, set, delete etc). Instead it is recommended to write your code in such a way they it performs the following steps:

  1. Attempt to retrieve the information.
  2. Generate the information.
  3. Attempt to set the information

Its also worth mentioning that not all stores support key tests. For stores that don't support key tests this functionality is mimicked by using the equivalent get method. Just one more reason you should not use these methods unless you have a very good reason to do so.

Parameters
string | int$key
bool$tryloadifpossibleIf set to true, the cache doesn't contain the key, and there is another cache loader or data source then the code will try load the key value from the next item in the chain.
Return values
boolTrue if the cache has the requested key, false otherwise.

Reimplemented from cache.

◆ has_a_ttl()

cache::has_a_ttl ( )
protectedinherited

Returns true if the cache is making use of a ttl.

Return values
bool

◆ has_all()

cache_session::has_all ( array $keys)

Test is a cache has all of the given keys.

It is strongly recommended to avoid the use of this function if not absolutely required. In a high load environment the cache may well change between the test and any subsequent action (get, set, delete etc).

Its also worth mentioning that not all stores support key tests. For stores that don't support key tests this functionality is mimicked by using the equivalent get method. Just one more reason you should not use these methods unless you have a very good reason to do so.

Parameters
array$keys
Return values
boolTrue if the cache has all of the given keys, false otherwise.

Reimplemented from cache.

◆ has_any()

cache_session::has_any ( array $keys)

Test if a cache has at least one of the given keys.

It is strongly recommended to avoid the use of this function if not absolutely required. In a high load environment the cache may well change between the test and any subsequent action (get, set, delete etc).

Its also worth mentioning that not all stores support key tests. For stores that don't support key tests this functionality is mimicked by using the equivalent get method. Just one more reason you should not use these methods unless you have a very good reason to do so.

Parameters
array$keys
Return values
boolTrue if the cache has at least one of the given keys

Reimplemented from cache.

◆ is_in_persist_cache()

cache::is_in_persist_cache ( )
protectedinherited
See also
cache\static_acceleration_has
Deprecated
since 2.6

◆ is_using_persist_cache()

cache::is_using_persist_cache ( )
protectedinherited
Deprecated
since 2.6
See also
cache\use_static_acceleration()

◆ make()

static cache::make ( $component,
$area,
array $identifiers = array(),
$unused = null )
staticinherited

Creates a new cache instance for a pre-defined definition.

Parameters
string$componentThe component for the definition
string$areaThe area for the definition
array$identifiersAny additional identifiers that should be provided to the definition.
string$unusedUsed to be datasourceaggregate but that was removed and this is now unused.
Return values
cache_application|cache_session|cache_store

◆ make_from_params()

static cache::make_from_params ( $mode,
$component,
$area,
array $identifiers = array(),
array $options = array() )
staticinherited

Creates a new cache instance based upon the given params.

Parameters
int$modeOne of cache_store\MODE_*
string$componentThe component this cache relates to.
string$areaThe area this cache relates to.
array$identifiersAny additional identifiers that should be provided to the definition.
array$optionsAn array of options, available options are:
  • simplekeys : Set to true if the keys you will use are a-zA-Z0-9_
  • simpledata : Set to true if the type of the data you are going to store is scalar, or an array of scalar vars
  • staticacceleration : If set to true the cache will hold onto data passing through it.
  • staticaccelerationsize : The max size for the static acceleration array.
Return values
cache_application|cache_session|cache_request

◆ now()

static cache::now ( $float = false)
staticinherited

Returns the timestamp from the first request for the time from the cache API.

This stamp needs to be used for all ttl and time based operations to ensure that we don't end up with timing issues.

Parameters
bool$floatWhether to use floating precision accuracy.
Return values
int|float

◆ parse_key()

cache_session::parse_key ( $key)
protected

Parses the key turning it into a string (or array is required) suitable to be passed to the cache store.

This function is called for every operation that uses keys. For this reason we use this function to also check that the current user is the same as the user who last used this cache.

On top of that if prepends the string 'sess_' to the start of all keys. The _ ensures things are easily identifiable.

Parameters
string | int$keyAs passed to get|set|delete etc.
Return values
string|arrayString unless the store supports multi-identifiers in which case an array if returned.

Reimplemented from cache.

◆ purge()

cache_session::purge ( )

Purges the cache store, and loader if there is one.

Return values
boolTrue on success, false otherwise

Reimplemented from cache.

◆ purge_current_user()

cache_session::purge_current_user ( )

Purges the session cache of all data belonging to the current user.

Reimplemented from cache.

◆ requires_serialisation()

cache::requires_serialisation ( $value,
$depth = 1 )
protectedinherited

Checks to see if a var requires serialisation.

Parameters
mixed$valueThe value to check.
int$depthUsed to ensure we don't enter an endless loop (think recursion).
Return values
boolReturns true if the value is going to require serialisation in order to ensure a reference free copy or false if its safe to clone.

◆ set()

cache_session::set ( $key,
$data )

Sends a key => value pair to the cache.

// This code will add four entries to the cache, one for each url. $cache->set('main', 'http://moodle.org'); $cache->set('docs', 'http://docs.moodle.org'); $cache->set('tracker', 'http://tracker.moodle.org'); $cache->set('qa', 'http://qa.moodle.net');

Parameters
string | int$keyThe key for the data being requested. It can be any structure although using a scalar string or int is recommended in the interests of performance. In advanced cases an array may be useful such as in situations requiring the multi-key functionality.
mixed$dataThe data to set against the key.
Return values
boolTrue on success, false otherwise.

Reimplemented from cache.

◆ set_data_source()

cache::set_data_source ( cache_data_source $datasource)
protectedinherited

Set the data source for this cache.

Parameters
cache_data_source$datasource

◆ set_identifiers()

cache::set_identifiers ( array $identifiers)
inherited

Alters the identifiers that have been provided to the definition.

This is an advanced method and should not be used unless really needed. It allows the developer to slightly alter the definition without having to re-establish the cache. It will cause more processing as the definition will need to clear and reprepare some of its properties.

Parameters
array$identifiers

◆ set_implementation()

cache::set_implementation ( $key,
int $version,
$data,
bool $setparents = true )
protectedinherited

Sets the value for the given key, optionally with a version tag.

Parameters
string | int$keyThe key for the data being set.
int$versionVersion number for the data or cache\VERSION_NONE if none
mixed$dataThe data to set against the key.
bool$setparentsIf true, sets all parent loaders, otherwise only this one
Return values
boolTrue on success, false otherwise.

Reimplemented in cache_application, and cache_disabled.

◆ set_in_persist_cache()

cache::set_in_persist_cache ( )
protectedinherited
Deprecated
since 2.6
See also
cache\static_acceleration_set

◆ set_is_sub_loader()

cache::set_is_sub_loader ( $setting = true)
protectedinherited

Used to inform the loader of its state as a sub loader, or as the top of the chain.

This is important as it ensures that we do not have more than one loader keeping static acceleration data. Subloaders need to be "pure" loaders in the sense that they are used to store and retrieve information from stores or the next loader/data source in the chain. Nothing fancy, nothing flash.

Parameters
bool$setting

◆ set_loader()

cache::set_loader ( cache_loader $loader)
protectedinherited

Set the loader for this cache.

Parameters
cache_loader$loader

◆ set_many()

cache_session::set_many ( array $keyvaluearray)

Sends several key => value pairs to the cache.

Using this function comes with potential performance implications. Not all cache stores will support get_many/set_many operations and in order to replicate this functionality will call the equivalent singular method for each item provided. This should not deter you from using this function as there is a performance benefit in situations where the cache store does support it, but you should be aware of this fact.

// This code will add four entries to the cache, one for each url. $cache->set_many(array( 'main' => 'http://moodle.org', 'docs' => 'http://docs.moodle.org', 'tracker' => 'http://tracker.moodle.org', 'qa' => ''http://qa.moodle.net' ));

Parameters
array$keyvaluearrayAn array of key => value pairs to send to the cache.
Return values
intThe number of items successfully set. It is up to the developer to check this matches the number of items. ... if they care that is.

Reimplemented from cache.

◆ set_versioned()

cache::set_versioned ( $key,
int $version,
$data )
inherited

Sets the value for the given key with the given version.

The cache does not store multiple versions - any existing version will be overwritten with this one. This function should only be used if there is a known 'current version' (e.g. stored in a database table). It only ensures that the cache does not return outdated data.

This function can be used to help implement localisable caches (where the cache could be stored on a local server as well as a shared cache). The version will be recorded alongside the item and get_versioned will always return the correct version.

The version number must be an integer that always increases. This could be based on the current time, or a stored value that increases by 1 each time it changes, etc.

If you use this function you must use get_versioned to retrieve the data.

Parameters
string | int$keyThe key for the data being set.
int$versionInteger for the version of the data
mixed$dataThe data to set against the key.
Return values
boolTrue on success, false otherwise.

Implements cache_loader.

◆ static_acceleration_delete()

cache::static_acceleration_delete ( $key)
protectedinherited

Deletes an item from the static acceleration array.

Parameters
string | int$keyAs given to get|set|delete
Return values
boolTrue on success, false otherwise.

◆ static_acceleration_get()

cache::static_acceleration_get ( $key)
protectedinherited

Returns the item from the static acceleration array if it exists there.

Parameters
string$keyThe parsed key
Return values
mixed|falseDereferenced data from the static acceleration array or false if it wasn't there.

◆ static_acceleration_has()

cache::static_acceleration_has ( $key)
protectedinherited

Returns true if the requested key exists within the static acceleration array.

Parameters
string$keyThe parsed key
Return values
bool

◆ static_acceleration_set()

cache::static_acceleration_set ( $key,
$data )
protectedinherited

Sets a key value pair into the static acceleration array.

Parameters
string$keyThe parsed key
mixed$data
Return values
bool

◆ store_supports_key_awareness()

cache::store_supports_key_awareness ( )
protectedinherited

Returns true if the store supports key awareness.

Return values
bool

◆ store_supports_native_locking()

cache::store_supports_native_locking ( )
protectedinherited

Returns true if the store natively supports locking.

Return values
bool

◆ store_supports_native_ttl()

cache::store_supports_native_ttl ( )
protectedinherited

Returns true if the cache store supports native ttl.

Return values
bool

◆ unref()

cache::unref ( $data)
protectedinherited

Removes references where required.

Parameters
stdClass | array$data
Return values
mixedWhat ever was put in but without any references.

◆ use_static_acceleration()

cache_session::use_static_acceleration ( )
protected

The session loader never uses static acceleration.

Instead it stores things in the static $session variable. Shared between all session loaders.

Return values
bool

Reimplemented from cache.

Member Data Documentation

◆ $nativelocking

cache_store null cache::$nativelocking = null
protectedinherited

Gets set to true if the cache's primary store natively supports locking.

If it does then we use that, otherwise we need to instantiate a second store to use for locking.

◆ $now

int cache::$now
staticprotectedinherited

We need a timestamp to use within the cache API.

This stamp needs to be used for all ttl and time based operations to ensure that we don't end up with timing issues.

◆ $purgetoken

string cache::$purgetoken
staticprotectedinherited

A purge token used to distinguish between multiple cache purges in the same second.

This is in the format <microtime>-<random string>.

◆ $storetype

strubg cache::$storetype = 'unknown'
protectedinherited

Gets set to the class name of the store during initialisation.

This is used several times in the cache class internally and having it here helps speed up processing.


The documentation for this class was generated from the following file: