Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
GenericCache Class Reference
Inheritance diagram for GenericCache:
APCCache FileCache MemcacheCache XCacheCache

Public Member Functions

 close ()
 
 flush ()
 
 GenericCache ($context, $cacheId, $fallback)
 
 get ($id)
 
 getCache ($id)
 
 getCacheId ()
 
 getCacheTime ()
 
 getContext ()
 
 set ($id, $value)
 
 setCache ($id, $value)
 
 setEntireCache (&$contents)
 

Public Attributes

 $cacheId
 
 $context
 
 $fallback
 

Detailed Description

Provides implementation-independent caching. Although this class is intended to be overridden with a more specific implementation, it can be used as the null cache.

Definition at line 23 of file GenericCache.inc.php.

Member Function Documentation

GenericCache::close ( )

Close the cache. (Optionally overridden by subclasses.)

Definition at line 115 of file GenericCache.inc.php.

GenericCache::flush ( )

Flush the cache.

Definition at line 79 of file GenericCache.inc.php.

Referenced by setEntireCache().

GenericCache::GenericCache (   $context,
  $cacheId,
  $fallback 
)

Instantiate a cache.

Definition at line 50 of file GenericCache.inc.php.

References $cacheId, $context, and $fallback.

GenericCache::get (   $id)

Get an object from cache, using the fallback if necessary.

Definition at line 60 of file GenericCache.inc.php.

References getCache().

GenericCache::getCache (   $id)

Get an object from the cache. This function should be overridden by subclasses.

Parameters
$id

Definition at line 99 of file GenericCache.inc.php.

Referenced by get().

GenericCache::getCacheId ( )
GenericCache::getCacheTime ( )

Get the time at which the data was cached.

Definition at line 135 of file GenericCache.inc.php.

GenericCache::getContext ( )
GenericCache::set (   $id,
  $value 
)

Set an object in the cache. This function should be overridden by subclasses.

Definition at line 72 of file GenericCache.inc.php.

References setCache().

GenericCache::setCache (   $id,
  $value 
)

Set an object in the cache. This function should be overridden by subclasses.

Parameters
$id
$value

Definition at line 109 of file GenericCache.inc.php.

Referenced by set(), and setEntireCache().

GenericCache::setEntireCache ( $contents)

Set the entire contents of the cache. May (should) be overridden by subclasses.

Parameters
$arrayarray of id -> value pairs

Definition at line 87 of file GenericCache.inc.php.

References flush(), and setCache().

Member Data Documentation

GenericCache::$cacheId

The ID of this particular cache within the context

Definition at line 33 of file GenericCache.inc.php.

Referenced by APCCache\APCCache(), FileCache\FileCache(), GenericCache(), getCacheId(), MemcacheCache\MemcacheCache(), and XCacheCache\XCacheCache().

GenericCache::$context

The unique string identifying the context of this cache. Must be suitable for a filename.

Definition at line 28 of file GenericCache.inc.php.

Referenced by APCCache\APCCache(), FileCache\FileCache(), GenericCache(), getContext(), MemcacheCache\MemcacheCache(), and XCacheCache\XCacheCache().

GenericCache::$fallback

The getter fallback callback (for a cache miss) This function is called with two parameters:

  1. The cache object that is suffering a miss
  2. The id of the value to fetch The function is responsible for loading data into the cache, using setEntireCache or setCache.

Definition at line 45 of file GenericCache.inc.php.

Referenced by APCCache\APCCache(), FileCache\FileCache(), GenericCache(), MemcacheCache\MemcacheCache(), and XCacheCache\XCacheCache().


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