Public Member Functions | Protected Attributes

Zend_Cache_Backend_TwoLevels Class Reference

Inheritance diagram for Zend_Cache_Backend_TwoLevels:
Zend_Cache_Backend Zend_Cache_Backend_ExtendedInterface Zend_Cache_Backend_Interface

Public Member Functions

 __construct (array $options=array())
 test ($id)
 save ($data, $id, $tags=array(), $specificLifetime=false, $priority=8)
 load ($id, $doNotTestCacheValidity=false)
 remove ($id)
 clean ($mode=Zend_Cache::CLEANING_MODE_ALL, $tags=array())
 getIds ()
 getTags ()
 getIdsMatchingTags ($tags=array())
 getIdsNotMatchingTags ($tags=array())
 getIdsMatchingAnyTags ($tags=array())
 getFillingPercentage ()
 getMetadatas ($id)
 touch ($id, $extraLifetime)
 getCapabilities ()
 ___expire ($id)

Protected Attributes

 $_options
 $_slowBackend
 $_fastBackend
 $_fastBackendFillingPercentage = null

Detailed Description

Definition at line 42 of file TwoLevels.php.


Constructor & Destructor Documentation

__construct ( array $  options = array() )

Constructor

Parameters:
array$optionsAssociative array of options
Exceptions:
Zend_Cache_Exception
Returns:
void

Reimplemented from Zend_Cache_Backend.

Definition at line 121 of file TwoLevels.php.


Member Function Documentation

___expire ( id )

PUBLIC METHOD FOR UNIT TESTING ONLY !

Force a cache record to expire

Parameters:
string$idcache id

Definition at line 476 of file TwoLevels.php.

clean ( mode = Zend_Cache::CLEANING_MODE_ALL,
tags = array() 
)

Clean some cache records

Available modes are : Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags ($tags can be an array of strings or a single string) Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} ($tags can be an array of strings or a single string) Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags ($tags can be an array of strings or a single string)

Parameters:
string$modeClean mode
array$tagsArray of tags
Exceptions:
Zend_Cache_Exception
Returns:
boolean true if no problem

Implements Zend_Cache_Backend_Interface.

Definition at line 254 of file TwoLevels.php.

getCapabilities (  )

Return an associative array of capabilities (booleans) of the backend

The array must include these keys :

  • automatic_cleaning (is automating cleaning necessary)
  • tags (are tags supported)
  • expired_read (is it possible to read expired cache records (for doNotTestCacheValidity option for example))
  • priority does the backend deal with priority when saving
  • infinite_lifetime (is infinite lifetime can work with this backend)
  • get_list (is it possible to get the list of cache ids and the complete list of tags)
Returns:
array associative of with capabilities

Implements Zend_Cache_Backend_ExtendedInterface.

Definition at line 409 of file TwoLevels.php.

getFillingPercentage (  )

Return the filling percentage of the backend storage

Returns:
int integer between 0 and 100

Implements Zend_Cache_Backend_ExtendedInterface.

Definition at line 362 of file TwoLevels.php.

getIds (  )

Return an array of stored cache ids

Returns:
array array of stored cache ids (string)

Implements Zend_Cache_Backend_ExtendedInterface.

Definition at line 302 of file TwoLevels.php.

getIdsMatchingAnyTags ( tags = array() )

Return an array of stored cache ids which match any given tags

In case of multiple tags, a logical AND is made between tags

Parameters:
array$tagsarray of tags
Returns:
array array of any matching cache ids (string)

Implements Zend_Cache_Backend_ExtendedInterface.

Definition at line 351 of file TwoLevels.php.

getIdsMatchingTags ( tags = array() )

Return an array of stored cache ids which match given tags

In case of multiple tags, a logical AND is made between tags

Parameters:
array$tagsarray of tags
Returns:
array array of matching cache ids (string)

Implements Zend_Cache_Backend_ExtendedInterface.

Definition at line 325 of file TwoLevels.php.

getIdsNotMatchingTags ( tags = array() )

Return an array of stored cache ids which don't match given tags

In case of multiple tags, a logical OR is made between tags

Parameters:
array$tagsarray of tags
Returns:
array array of not matching cache ids (string)

Implements Zend_Cache_Backend_ExtendedInterface.

Definition at line 338 of file TwoLevels.php.

getMetadatas ( id )

Return an array of metadatas for the given cache id

The array must include these keys :

  • expire : the expire timestamp
  • tags : a string array of tags
  • mtime : timestamp of last modification time
Parameters:
string$idcache id
Returns:
array array of metadatas (false if the cache id is not found)

Implements Zend_Cache_Backend_ExtendedInterface.

Definition at line 378 of file TwoLevels.php.

getTags (  )

Return an array of stored tags

Returns:
array array of stored tags (string)

Implements Zend_Cache_Backend_ExtendedInterface.

Definition at line 312 of file TwoLevels.php.

load ( id,
doNotTestCacheValidity = false 
)

Test if a cache is available for the given id and (if yes) return it (false else)

Note : return value is always "string" (unserialization is done by the core not by the backend)

Parameters:
string$idCache id
boolean$doNotTestCacheValidityIf set to true, the cache validity won't be tested
Returns:
string|false cached datas

Implements Zend_Cache_Backend_Interface.

Definition at line 194 of file TwoLevels.php.

remove ( id )

Remove a cache record

Parameters:
string$idCache id
Returns:
boolean True if no problem

Implements Zend_Cache_Backend_Interface.

Definition at line 229 of file TwoLevels.php.

save ( data,
id,
tags = array(),
specificLifetime = false,
priority = 8 
)

Save some string datas into a cache record

Note : $data is always "string" (serialization is done by the core not by the backend)

Parameters:
string$dataDatas to cache
string$idCache id
array$tagsArray of strings, the cache record will be tagged by each string entry
int$specificLifetimeIf != false, set a specific lifetime for this cache record (null => infinite lifetime)
int$priorityinteger between 0 (very low priority) and 10 (maximum priority) used by some particular backends
Returns:
boolean true if no problem

Definition at line 171 of file TwoLevels.php.

test ( id )

Test if a cache is available or not (for the given id)

Parameters:
string$idcache id
Returns:
mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record

Implements Zend_Cache_Backend_Interface.

Definition at line 148 of file TwoLevels.php.

touch ( id,
extraLifetime 
)

Give (if possible) an extra lifetime to the given cache id

Parameters:
string$idcache id
int$extraLifetime
Returns:
boolean true if ok

Implements Zend_Cache_Backend_ExtendedInterface.

Definition at line 390 of file TwoLevels.php.


Field Documentation

$_options [protected]
Initial value:
 array(
        'slow_backend' => 'File',
        'fast_backend' => 'Apc',
        'slow_backend_options' => array(),
        'fast_backend_options' => array(),
        'stats_update_factor' => 10,
        'slow_backend_custom_naming' => false,
        'fast_backend_custom_naming' => false,
        'slow_backend_autoload' => false,
        'fast_backend_autoload' => false,
        'auto_refresh_fast_cache' => true
    )

Reimplemented from Zend_Cache_Backend.

Definition at line 80 of file TwoLevels.php.


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