Zend Framework  1.12
Public Member Functions | Protected Attributes | List of all members
Zend_Cache_Backend_Test Class Reference

Public Member Functions

 __construct ($options=array())
 Constructor.
 
 setDirectives ($directives)
 Set the frontend directives.
 
 load ($id, $doNotTestCacheValidity=false)
 Test if a cache is available for the given id and (if yes) return it (false else)
 
 test ($id)
 Test if a cache is available or not (for the given id)
 
 save ($data, $id, $tags=array(), $specificLifetime=false)
 Save some string datas into a cache record.
 
 remove ($id)
 Remove a cache record.
 
 clean ($mode=Zend_Cache::CLEANING_MODE_ALL, $tags=array())
 Clean some cache records.
 
 getLastLog ()
 Get the last log.
 
 getLogIndex ()
 Get the log index.
 
 getAllLogs ()
 Get the complete log array.
 
 isAutomaticCleaningAvailable ()
 Return true if the automatic cleaning is available for the backend.
 
 getIds ()
 Return an array of stored cache ids.
 
 getTags ()
 Return an array of stored tags.
 
 getIdsMatchingTags ($tags=array())
 Return an array of stored cache ids which match given tags.
 
 getIdsNotMatchingTags ($tags=array())
 Return an array of stored cache ids which don't match given tags.
 
 getIdsMatchingAnyTags ($tags=array())
 Return an array of stored cache ids which match any given tags.
 
 getFillingPercentage ()
 Return the filling percentage of the backend storage.
 
 getMetadatas ($id)
 Return an array of metadatas for the given cache id.
 
 touch ($id, $extraLifetime)
 Give (if possible) an extra lifetime to the given cache id.
 
 getCapabilities ()
 Return an associative array of capabilities (booleans) of the backend.
 
- Public Member Functions inherited from Zend_Cache_Backend
 __construct (array $options=array())
 Constructor.
 
 setDirectives ($directives)
 Set the frontend directives.
 
 setOption ($name, $value)
 Set an option.
 
 getOption ($name)
 Returns an option.
 
 getLifetime ($specificLifetime)
 Get the life time.
 
 isAutomaticCleaningAvailable ()
 Return true if the automatic cleaning is available for the backend.
 
 getTmpDir ()
 Determine system TMP directory and detect if we have read access.
 

Protected Attributes

 $_options = array()
 
 $_directives = array()
 
- Protected Attributes inherited from Zend_Cache_Backend
 $_directives
 
 $_options = array()
 

Additional Inherited Members

- Protected Member Functions inherited from Zend_Cache_Backend
 _isGoodTmpDir ($dir)
 Verify if the given temporary directory is readable and writable.
 
 _loggerSanity ()
 Make sure if we enable logging that the Zend_Log class is available.
 
 _log ($message, $priority=4)
 Log a message at the WARN (4) priority.
 

Constructor & Destructor Documentation

__construct (   $options = array())

Constructor.

Parameters
array$optionsassociative array of options
Returns
void

Member Function Documentation

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

Clean some cache records.

For this test backend only, if $mode == 'false', then the method will return false (true else)

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)

Parameters
string$modeClean mode
array$tagsArray of tags
Returns
boolean True if no problem

Implements Zend_Cache_Backend_Interface.

getAllLogs ( )

Get the complete log array.

Returns
array Complete log array
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.

getFillingPercentage ( )

Return the filling percentage of the backend storage.

Returns
int integer between 0 and 100

Implements Zend_Cache_Backend_ExtendedInterface.

getIds ( )

Return an array of stored cache ids.

Returns
array array of stored cache ids (string)

Implements Zend_Cache_Backend_ExtendedInterface.

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.

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.

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.

getLastLog ( )

Get the last log.

Returns
string The last log
getLogIndex ( )

Get the log index.

Returns
int Log index
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.

getTags ( )

Return an array of stored tags.

Returns
array array of stored tags (string)

Implements Zend_Cache_Backend_ExtendedInterface.

isAutomaticCleaningAvailable ( )

Return true if the automatic cleaning is available for the backend.

Returns
boolean
load (   $id,
  $doNotTestCacheValidity = false 
)

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

For this test backend only, if $id == 'false', then the method will return false if $id == 'serialized', the method will return a serialized array ('foo' else)

Parameters
string$idCache id
boolean$doNotTestCacheValidityIf set to true, the cache validity won't be tested
Returns
string Cached datas (or false)

Implements Zend_Cache_Backend_Interface.

remove (   $id)

Remove a cache record.

For this test backend only, if $id == 'false', then the method will return false (true else)

Parameters
string$idCache id
Returns
boolean True if no problem

Implements Zend_Cache_Backend_Interface.

save (   $data,
  $id,
  $tags = array(),
  $specificLifetime = false 
)

Save some string datas into a cache record.

For this test backend only, if $id == 'false', then the method will return false (true else)

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)
Returns
boolean True if no problem

Implements Zend_Cache_Backend_Interface.

setDirectives (   $directives)

Set the frontend directives.

Parameters
array$directivesassoc of directives
Returns
void

Implements Zend_Cache_Backend_Interface.

test (   $id)

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

For this test backend only, if $id == 'false', then the method will return false (123456 else)

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

Implements Zend_Cache_Backend_Interface.

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.

Member Data Documentation

$_directives = array()
protected
$_options = array()
protected