Elgg  Version 6.1
Public Member Functions | Protected Attributes | List of all members
Elgg\Cache\BaseCache Class Reference

The Elgg cache base class. More...

Inheritance diagram for Elgg\Cache\BaseCache:
Elgg\Cache\CompositeCache

Public Member Functions

 setVariable (string $variable, $value)
 Set a cache variable. More...
 
 getVariable (string $variable)
 Get variables for this cache. More...
 
 __get (string $key)
 Class member get overloading, returning key using $this->load defaults. More...
 
 __set (string $key, $value)
 Class member set overloading, setting a key using $this->save defaults. More...
 
 __isset (string $key)
 Supporting isset, using $this->load() with default values. More...
 
 __unset (string $key)
 Supporting unsetting of magic attributes. More...
 
 save ($key, $data, $expire_after=null)
 Save data in a cache. More...
 
 load ($key)
 Load data from the cache using a given key. More...
 
 delete ($key)
 Invalidate a key. More...
 
 clear ()
 Clear out all the contents of the cache. More...
 
 invalidate ()
 Invalidate the contents of the cache. More...
 
 purge ()
 Purge old/stale contents of the cache. More...
 
 disable ()
 Disable cache Do not write or read from cache. More...
 
 enable ()
 Enable disabled cache. More...
 
 populate (array $values, int $expires_after=null)
 Populate cache from an array of key => values. More...
 
 add (string $key, $data)
 Add a key only if it doesn't already exist. More...
 
 offsetSet ($offset, $value)
 Assigns a value for the specified key. More...
 
 offsetGet ($offset)
 Get the value for specified key. More...
 
 offsetUnset ($offset)
 Unsets a key. More...
 
 offsetExists ($offset)
 Does key exist. More...
 

Protected Attributes

bool $disabled = false
 

Detailed Description

The Elgg cache base class.

This defines the interface for a cache (wherever that cache is stored).

Definition at line 9 of file BaseCache.php.

Member Function Documentation

Elgg\Cache\BaseCache::__get ( string  $key)

Class member get overloading, returning key using $this->load defaults.

Parameters
string$keyName
Returns
mixed

Definition at line 50 of file BaseCache.php.

Elgg\Cache\BaseCache::__isset ( string  $key)

Supporting isset, using $this->load() with default values.

Parameters
string$keyThe name of the attribute or metadata.
Returns
bool

Definition at line 73 of file BaseCache.php.

Elgg\Cache\BaseCache::__set ( string  $key,
  $value 
)

Class member set overloading, setting a key using $this->save defaults.

Parameters
string$keyName
mixed$valueValue
Returns
void

Definition at line 62 of file BaseCache.php.

Elgg\Cache\BaseCache::__unset ( string  $key)

Supporting unsetting of magic attributes.

Parameters
string$keyThe name of the attribute or metadata.
Returns
void

Definition at line 84 of file BaseCache.php.

Elgg\Cache\BaseCache::add ( string  $key,
  $data 
)

Add a key only if it doesn't already exist.

Implemented simply here, if you extend this class and your caching engine provides a better way then override this accordingly.

Parameters
string$keyName
mixed$dataValue
Returns
bool

Definition at line 180 of file BaseCache.php.

Elgg\Cache\BaseCache::clear ( )
abstract

Clear out all the contents of the cache.

Returns
bool
Elgg\Cache\BaseCache::delete (   $key)
abstract

Invalidate a key.

Parameters
string$keyName
Returns
bool
Elgg\Cache\BaseCache::disable ( )

Disable cache Do not write or read from cache.

Returns
void

Definition at line 143 of file BaseCache.php.

Elgg\Cache\BaseCache::enable ( )

Enable disabled cache.

Returns
void

Definition at line 151 of file BaseCache.php.

Elgg\Cache\BaseCache::getVariable ( string  $variable)

Get variables for this cache.

Parameters
string$variableName
Returns
mixed The variable or null;

Definition at line 39 of file BaseCache.php.

Elgg\Cache\BaseCache::invalidate ( )
abstract

Invalidate the contents of the cache.

Returns
bool
Elgg\Cache\BaseCache::load (   $key)
abstract

Load data from the cache using a given key.

Parameters
string$keyName
Returns
mixed|null The stored data or null if it's a miss
Elgg\Cache\BaseCache::offsetExists (   $offset)

Does key exist.

See also
::offsetExists()
Parameters
mixed$offsetA key (offset) to check for.
Returns
bool

Definition at line 245 of file BaseCache.php.

Elgg\Cache\BaseCache::offsetGet (   $offset)

Get the value for specified key.

See also
::offsetGet()
Parameters
mixed$offsetThe key (offset) to retrieve.
Returns
mixed

Definition at line 215 of file BaseCache.php.

Elgg\Cache\BaseCache::offsetSet (   $offset,
  $value 
)

Assigns a value for the specified key.

Parameters
mixed$offsetThe key (offset) to assign the value to.
mixed$valueThe value to set.
Returns
void
See also
::offsetSet()

Definition at line 201 of file BaseCache.php.

Elgg\Cache\BaseCache::offsetUnset (   $offset)

Unsets a key.

See also
::offsetUnset()
Parameters
mixed$offsetThe key (offset) to unset.
Returns
void

Definition at line 229 of file BaseCache.php.

Elgg\Cache\BaseCache::populate ( array  $values,
int  $expires_after = null 
)

Populate cache from an array of key => values.

Parameters
array$valuesValues
int$expires_afterExpiration duration
Returns
void

Definition at line 163 of file BaseCache.php.

Elgg\Cache\BaseCache::purge ( )
abstract

Purge old/stale contents of the cache.

Returns
bool
Elgg\Cache\BaseCache::save (   $key,
  $data,
  $expire_after = null 
)
abstract

Save data in a cache.

Parameters
string$keyName
mixed$dataValue
int$expire_afterNumber of seconds to expire the cache after
Returns
bool
Elgg\Cache\BaseCache::setVariable ( string  $variable,
  $value 
)

Set a cache variable.

Parameters
string$variableName
mixed$valueValue
Returns
void

Definition at line 28 of file BaseCache.php.

Member Data Documentation

bool Elgg\Cache\BaseCache::$disabled = false
protected

Definition at line 18 of file BaseCache.php.


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