Elgg  Version 4.3
Public Member Functions | Protected Attributes | List of all members
ElggCache Class Reference

The elgg cache superclass. More...

Inheritance diagram for ElggCache:
Elgg\Cache\CompositeCache

Public Member Functions

 __construct ()
 Set the constructor. More...
 
 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 ($key, $value)
 Assigns a value for the specified key. More...
 
 offsetGet ($key)
 Get the value for specified key. More...
 
 offsetUnset ($key)
 Unsets a key. More...
 
 offsetExists ($key)
 Does key exist. More...
 

Protected Attributes

 $disabled = false
 

Detailed Description

The elgg cache superclass.

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

Definition at line 6 of file ElggCache.php.

Constructor & Destructor Documentation

ElggCache::__construct ( )

Set the constructor.

Definition at line 22 of file ElggCache.php.

Member Function Documentation

ElggCache::__get ( string  $key)

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

Parameters
string$keyName
Returns
mixed

Definition at line 55 of file ElggCache.php.

ElggCache::__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 78 of file ElggCache.php.

ElggCache::__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 67 of file ElggCache.php.

ElggCache::__unset ( string  $key)

Supporting unsetting of magic attributes.

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

Definition at line 89 of file ElggCache.php.

ElggCache::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 185 of file ElggCache.php.

ElggCache::clear ( )
abstract

Clear out all the contents of the cache.

Returns
bool
ElggCache::delete (   $key)
abstract

Invalidate a key.

Parameters
string$keyName
Returns
bool
ElggCache::disable ( )

Disable cache Do not write or read from cache.

Returns
void

Definition at line 148 of file ElggCache.php.

ElggCache::enable ( )

Enable disabled cache.

Returns
void

Definition at line 156 of file ElggCache.php.

ElggCache::getVariable ( string  $variable)

Get variables for this cache.

Parameters
string$variableName
Returns
mixed The variable or null;

Definition at line 44 of file ElggCache.php.

ElggCache::invalidate ( )
abstract

Invalidate the contents of the cache.

Returns
bool
ElggCache::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
ElggCache::offsetExists (   $key)

Does key exist.

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

Definition at line 250 of file ElggCache.php.

ElggCache::offsetGet (   $key)

Get the value for specified key.

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

Definition at line 220 of file ElggCache.php.

ElggCache::offsetSet (   $key,
  $value 
)

Assigns a value for the specified key.

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

Definition at line 206 of file ElggCache.php.

ElggCache::offsetUnset (   $key)

Unsets a key.

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

Definition at line 234 of file ElggCache.php.

ElggCache::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 168 of file ElggCache.php.

ElggCache::purge ( )
abstract

Purge old/stale contents of the cache.

Returns
bool
ElggCache::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
ElggCache::setVariable ( string  $variable,
  $value 
)

Set a cache variable.

Parameters
string$variableName
mixed$valueValue
Returns
void

Definition at line 33 of file ElggCache.php.

Member Data Documentation

ElggCache::$disabled = false
protected

Definition at line 17 of file ElggCache.php.


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