Class Zend_Cache_Backend_TwoLevels

Description

Implements interfaces:

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Cache/Backend/TwoLevels.php (line 42)

Zend_Cache_Backend
   |
   --Zend_Cache_Backend_TwoLevels
Variable Summary
Method Summary
 void __construct ([ $options = array()])
 boolean clean ([string $mode = Zend_Cache::CLEANING_MODE_ALL], [array $tags = array()])
 array getCapabilities ()
 array getIds ()
 array getIdsMatchingAnyTags ([array $tags = array()])
 array getIdsMatchingTags ([array $tags = array()])
 array getIdsNotMatchingTags ([array $tags = array()])
 array getMetadatas (string $id)
 array getTags ()
 string|false load (string $id, [boolean $doNotTestCacheValidity = false])
 boolean remove (string $id)
 boolean save (string $data, string $id, [array $tags = array()], [int $specificLifetime = false], [int $priority = 8])
 mixed|false test (string $id)
 boolean touch (string $id, int $extraLifetime)
 void ___expire (string $id)
Variables
Zend_Cache_Backend $_fastBackend (line 105)

Fast Backend

  • access: protected
int $_fastBackendFillingPercentage = null (line 112)

Cache for the fast backend filling percentage

  • access: protected
array $_options = 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)
(line 80)

Available options

=====> (string) slow_backend :

  • Slow backend name
  • Must implement the Zend_Cache_Backend_ExtendedInterface
  • Should provide a big storage
=====> (string) fast_backend :
  • Flow backend name
  • Must implement the Zend_Cache_Backend_ExtendedInterface
  • Must be much faster than slow_backend
=====> (array) slow_backend_options :
  • Slow backend options (see corresponding backend)
=====> (array) fast_backend_options :
  • Fast backend options (see corresponding backend)
=====> (int) stats_update_factor :
  • Disable / Tune the computation of the fast backend filling percentage
  • When saving a record into cache : 1 => systematic computation of the fast backend filling percentage x (integer) > 1 => computation of the fast backend filling percentage randomly 1 times on x cache write
=====> (boolean) slow_backend_custom_naming : =====> (boolean) fast_backend_custom_naming : =====> (boolean) slow_backend_autoload : =====> (boolean) fast_backend_autoload :
  • See Zend_Cache::factory() method
=====> (boolean) auto_refresh_fast_cache
  • If true, auto refresh the fast cache when a cache record is hit

  • var: available options
  • access: protected

Redefinition of:
Zend_Cache_Backend::$_options
Available options
Zend_Cache_Backend $_slowBackend (line 98)

Slow Backend

  • access: protected

Inherited Variables

Inherited from Zend_Cache_Backend

Zend_Cache_Backend::$_directives
Methods
Constructor __construct (line 121)

Constructor

  • throws: Zend_Cache_Exception
  • access: public
void __construct ([ $options = array()])
  • array $options: Associative array of options

Redefinition of:
Zend_Cache_Backend::__construct()
Constructor
clean (line 279)

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)

  • return: true if no problem
  • throws: Zend_Cache_Exception
  • access: public
boolean clean ([string $mode = Zend_Cache::CLEANING_MODE_ALL], [array $tags = array()])
  • string $mode: Clean mode
  • array $tags: Array of tags

Implementation of:
Zend_Cache_Backend_Interface::clean()
Clean some cache records
getCapabilities (line 434)

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)

  • return: associative of with capabilities
  • access: public
array getCapabilities ()

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getCapabilities()
Return an associative array of capabilities (booleans) of the backend
getFillingPercentage (line 387)

Return the filling percentage of the backend storage

  • return: integer between 0 and 100
  • access: public
int getFillingPercentage ()

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getFillingPercentage()
Return the filling percentage of the backend storage
getIds (line 327)

Return an array of stored cache ids

  • return: array of stored cache ids (string)
  • access: public
array getIds ()

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getIds()
Return an array of stored cache ids
getIdsMatchingAnyTags (line 376)

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

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

  • return: array of any matching cache ids (string)
  • access: public
array getIdsMatchingAnyTags ([array $tags = array()])
  • array $tags: array of tags

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getIdsMatchingAnyTags()
Return an array of stored cache ids which match any given tags
getIdsMatchingTags (line 350)

Return an array of stored cache ids which match given tags

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

  • return: array of matching cache ids (string)
  • access: public
array getIdsMatchingTags ([array $tags = array()])
  • array $tags: array of tags

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getIdsMatchingTags()
Return an array of stored cache ids which match given tags
getIdsNotMatchingTags (line 363)

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

  • return: array of not matching cache ids (string)
  • access: public
array getIdsNotMatchingTags ([array $tags = array()])
  • array $tags: array of tags

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getIdsNotMatchingTags()
Return an array of stored cache ids which don't match given tags
getMetadatas (line 403)

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

  • return: array of metadatas (false if the cache id is not found)
  • access: public
array getMetadatas (string $id)
  • string $id: cache id

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getMetadatas()
Return an array of metadatas for the given cache id
getTags (line 337)

Return an array of stored tags

  • return: array of stored tags (string)
  • access: public
array getTags ()

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getTags()
Return an array of stored tags
load (line 219)

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)

  • return: cached datas
  • access: public
string|false load (string $id, [boolean $doNotTestCacheValidity = false])
  • string $id: Cache id
  • boolean $doNotTestCacheValidity: If set to true, the cache validity won't be tested

Implementation of:
Zend_Cache_Backend_Interface::load()
Test if a cache is available for the given id and (if yes) return it (false else)
remove (line 254)

Remove a cache record

  • return: True if no problem
  • access: public
boolean remove (string $id)
  • string $id: Cache id

Implementation of:
Zend_Cache_Backend_Interface::remove()
Remove a cache record
save (line 190)

Save some string datas into a cache record

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

  • return: true if no problem
  • access: public
boolean save (string $data, string $id, [array $tags = array()], [int $specificLifetime = false], [int $priority = 8])
  • string $data: Datas to cache
  • string $id: Cache id
  • array $tags: Array of strings, the cache record will be tagged by each string entry
  • int $specificLifetime: If != false, set a specific lifetime for this cache record (null => infinite lifetime)
  • int $priority: integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends

Implementation of:
Zend_Cache_Backend_Interface::save()
Save some string datas into a cache record
test (line 167)

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

  • return: (a cache is not available) or "last modified" timestamp (int) of the available cache record
  • access: public
mixed|false test (string $id)
  • string $id: cache id

Implementation of:
Zend_Cache_Backend_Interface::test()
Test if a cache is available or not (for the given id)
touch (line 415)

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

  • return: true if ok
  • access: public
boolean touch (string $id, int $extraLifetime)
  • string $id: cache id
  • int $extraLifetime

Implementation of:
Zend_Cache_Backend_ExtendedInterface::touch()
Give (if possible) an extra lifetime to the given cache id
___expire (line 501)

PUBLIC METHOD FOR UNIT TESTING ONLY !

Force a cache record to expire

  • access: public
void ___expire (string $id)
  • string $id: cache id

Inherited Methods

Inherited From Zend_Cache_Backend

 Zend_Cache_Backend::__construct()
 Zend_Cache_Backend::getLifetime()
 Zend_Cache_Backend::getTmpDir()
 Zend_Cache_Backend::isAutomaticCleaningAvailable()
 Zend_Cache_Backend::setDirectives()
 Zend_Cache_Backend::setOption()
 Zend_Cache_Backend::_isGoodTmpDir()
 Zend_Cache_Backend::_log()
 Zend_Cache_Backend::_loggerSanity()

Documentation generated on Mon, 21 Jun 2010 15:50:11 -0400 by phpDocumentor 1.4.3