Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
cachestore_dummy Class Reference

The cache dummy store. More...

Inheritance diagram for cachestore_dummy:
cache_store cache_store_interface

Public Member Functions

 __construct ($name='Dummy store', array $configuration=array())
 Constructs a dummy store instance. More...
 
 cleanup ()
 Performs any necessary clean up when the store instance is being deleted. More...
 
 create_clone (array $details=array())
 Creates a clone of this store instance ready to be initialised. More...
 
 delete ($key)
 Deletes an item from the cache. More...
 
 delete_many (array $keys)
 Deletes many items from the cache. More...
 
 get ($key)
 Returns the data for the given key. More...
 
 get_many ($keys)
 Gets' the values for many keys. More...
 
 get_warnings ()
 Can be overridden to return any warnings this store instance should make to the admin. More...
 
 initialise (cache_definition $definition)
 Initialises the store instance for a definition. More...
 
 instance_created ()
 Performs any necessary operation when the store instance has been created. More...
 
 instance_deleted ()
 Performs any necessary operation when the store instance is being deleted. More...
 
 is_initialised ()
 Returns true if this has been initialised. More...
 
 is_ready ()
 Returns true if this cache store instance is ready to use. More...
 
 is_searchable ()
 Returns true if the store instance is searchable. More...
 
 my_name ()
 Returns the name of this instance. More...
 
 purge ()
 Deletes all of the items from the cache. More...
 
 set ($key, $data)
 Sets an item in the cache. More...
 
 set_many (array $keyvaluearray)
 Sets many items in the cache. More...
 
 supports_data_guarantee ()
 Returns true if the store instance guarantees data. More...
 
 supports_dereferencing_objects ()
 Returns true if the store automatically dereferences objects. More...
 
 supports_multiple_identifiers ()
 Returns true if the store instance supports multiple identifiers. More...
 
 supports_native_ttl ()
 Returns true if the store instance supports native ttl. More...
 

Static Public Member Functions

static are_requirements_met ()
 Returns true if this store plugin is usable. More...
 
static can_add_instance ()
 Returns true if the user can add an instance. More...
 
static get_supported_features (array $configuration=array())
 Returns the supported features. More...
 
static get_supported_modes (array $configuration=array())
 Returns the supported mode. More...
 
static initialise_test_instance (cache_definition $definition)
 Generates an instance of the cache store that can be used for testing. More...
 
static is_supported_mode ($mode)
 Returns true the given mode is supported. More...
 
static ready_to_be_used_for_testing ()
 Returns true if this cache store instance is both suitable for testing, and ready for testing. More...
 
static unit_test_configuration ()
 Generates the appropriate configuration required for unit testing. More...
 

Public Attributes

const DEREFERENCES_OBJECTS = 16
 The cache store dereferences objects. More...
 
const IS_SEARCHABLE = 8
 The cache is searchable by key.
 
const MODE_APPLICATION = 1
 Application caches. More...
 
const MODE_REQUEST = 4
 Request caches. More...
 
const MODE_SESSION = 2
 Session caches. More...
 
const SUPPORTS_DATA_GUARANTEE = 2
 Ensures data remains in the cache once set.
 
const SUPPORTS_MULTIPLE_IDENTIFIERS = 1
 Supports multi-part keys.
 
const SUPPORTS_NATIVE_TTL = 4
 Supports a native ttl system.
 

Protected Attributes

string $name
 The name of this store.
 
bool $persist = false
 Gets set to true if this store is going to store data. More...
 
array $store = array()
 The stored data array.
 

Detailed Description

The cache dummy store.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

cachestore_dummy::__construct (   $name = 'Dummy store',
array  $configuration = array() 
)

Constructs a dummy store instance.

Parameters
string$name
array$configuration

Reimplemented from cache_store.

Member Function Documentation

◆ are_requirements_met()

static cachestore_dummy::are_requirements_met ( )
static

Returns true if this store plugin is usable.

Return values
bool

Implements cache_store_interface.

◆ can_add_instance()

static cachestore_dummy::can_add_instance ( )
static

Returns true if the user can add an instance.

Return values
bool

Reimplemented from cache_store.

◆ cleanup()

cachestore_dummy::cleanup ( )

Performs any necessary clean up when the store instance is being deleted.

Deprecated:
since 3.2
See also
cachestore_dummy::instance_deleted()

Reimplemented from cache_store.

◆ create_clone()

cache_store::create_clone ( array  $details = array())
inherited

Creates a clone of this store instance ready to be initialised.

This method is used so that a cache store needs only be constructed once. Future requests for an instance of the store will be given a cloned instance.

If you are writing a cache store that isn't compatible with the clone operation you can override this method to handle any situations you want before cloning.

Parameters
array$detailsAn array containing the details of the store from the cache config.
Return values
cache_store

◆ delete()

cachestore_dummy::delete (   $key)

Deletes an item from the cache.

Parameters
string$key
Return values
bool

Reimplemented from cache_store.

◆ delete_many()

cachestore_dummy::delete_many ( array  $keys)

Deletes many items from the cache.

Parameters
array$keys
Return values
bool

Reimplemented from cache_store.

◆ get()

cachestore_dummy::get (   $key)

Returns the data for the given key.

Parameters
string$key
Return values
string|false

Reimplemented from cache_store.

◆ get_many()

cachestore_dummy::get_many (   $keys)

Gets' the values for many keys.

Parameters
array$keys
Return values
bool

Reimplemented from cache_store.

◆ get_supported_features()

static cachestore_dummy::get_supported_features ( array  $configuration = array())
static

Returns the supported features.

Parameters
array$configuration
Return values
int

Implements cache_store_interface.

◆ get_supported_modes()

static cachestore_dummy::get_supported_modes ( array  $configuration = array())
static

Returns the supported mode.

Parameters
array$configuration
Return values
int

Implements cache_store_interface.

◆ get_warnings()

cache_store::get_warnings ( )
inherited

Can be overridden to return any warnings this store instance should make to the admin.

This should be used to notify things like configuration conflicts etc. The warnings returned here will be displayed on the cache configuration screen.

Return values
string[]An array of warning strings from the store instance.

Reimplemented in cachestore_memcached.

◆ initialise()

cachestore_dummy::initialise ( cache_definition  $definition)

Initialises the store instance for a definition.

Parameters
cache_definition$definition

Reimplemented from cache_store.

◆ initialise_test_instance()

static cachestore_dummy::initialise_test_instance ( cache_definition  $definition)
static

Generates an instance of the cache store that can be used for testing.

Parameters
cache_definition$definition
Return values
false

Implements cache_store_interface.

◆ instance_created()

cache_store::instance_created ( )
inherited

Performs any necessary operation when the store instance has been created.

Since
Moodle 2.5

Reimplemented in cachestore_file.

◆ instance_deleted()

cachestore_dummy::instance_deleted ( )

Performs any necessary operation when the store instance is being deleted.

This method may be called before the store has been initialised.

Since
Moodle 3.2

Reimplemented from cache_store.

◆ is_initialised()

cachestore_dummy::is_initialised ( )

Returns true if this has been initialised.

Return values
bool

Reimplemented from cache_store.

◆ is_ready()

cache_store::is_ready ( )
inherited

Returns true if this cache store instance is ready to use.

Return values
bool

Reimplemented in cachestore_redis, cachestore_mongodb, cachestore_memcached, and cachestore_file.

◆ is_searchable()

cache_store::is_searchable ( )
inherited

Returns true if the store instance is searchable.

Return values
bool

◆ is_supported_mode()

static cachestore_dummy::is_supported_mode (   $mode)
static

Returns true the given mode is supported.

Parameters
int$mode
Return values
bool

Implements cache_store_interface.

◆ my_name()

cachestore_dummy::my_name ( )

Returns the name of this instance.

Return values
string

Reimplemented from cache_store.

◆ purge()

cachestore_dummy::purge ( )

Deletes all of the items from the cache.

Return values
bool

Reimplemented from cache_store.

◆ ready_to_be_used_for_testing()

static cache_store::ready_to_be_used_for_testing ( )
staticinherited

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 values
bool

Reimplemented in cachestore_redis, cachestore_mongodb, cachestore_memcached, and cachestore_apcu.

◆ set()

cachestore_dummy::set (   $key,
  $data 
)

Sets an item in the cache.

Parameters
string$key
mixed$data
Return values
bool

Reimplemented from cache_store.

◆ set_many()

cachestore_dummy::set_many ( array  $keyvaluearray)

Sets many items in the cache.

Parameters
array$keyvaluearray
Return values
int

Reimplemented from cache_store.

◆ supports_data_guarantee()

cache_store::supports_data_guarantee ( )
inherited

Returns true if the store instance guarantees data.

Return values
bool

◆ supports_dereferencing_objects()

cache_store::supports_dereferencing_objects ( )
inherited

Returns true if the store automatically dereferences objects.

Return values
bool

◆ supports_multiple_identifiers()

cache_store::supports_multiple_identifiers ( )
inherited

Returns true if the store instance supports multiple identifiers.

Return values
bool

Reimplemented in cachestore_static, cachestore_session, cachestore_mongodb, cachestore_memcached, and cachestore_file.

◆ supports_native_ttl()

cache_store::supports_native_ttl ( )
inherited

Returns true if the store instance supports native ttl.

Return values
bool

◆ unit_test_configuration()

static cachestore_dummy::unit_test_configuration ( )
static

Generates the appropriate configuration required for unit testing.

Return values
arrayArray of unit test configuration data to be used by initialise().

Implements cache_store_interface.

Member Data Documentation

◆ $persist

bool cachestore_dummy::$persist = false
protected

Gets set to true if this store is going to store data.

This happens when the definition doesn't require static acceleration as the loader will not be storing information and something has to.

◆ DEREFERENCES_OBJECTS

const cache_store::DEREFERENCES_OBJECTS = 16
inherited

The cache store dereferences objects.

When set, loaders will assume that all data coming from this store has already had all references resolved. So even for complex object structures it will not try to remove references again.

◆ MODE_APPLICATION

const cache_store::MODE_APPLICATION = 1
inherited

Application caches.

These are shared caches.

◆ MODE_REQUEST

const cache_store::MODE_REQUEST = 4
inherited

Request caches.

Static caches really.

◆ MODE_SESSION

const cache_store::MODE_SESSION = 2
inherited

Session caches.

Just access to the PHP session.


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