package Zend_Cache
subpackage Zend_Cache_Backend
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Cache_Backend

 Methods

Constructor

__construct(array $options = array()) : void
inherited_from \Zend_Cache_Backend::__construct()

Parameters

$options

array

associative array of options

Exceptions

\Zend_Cache_Exception

Constructor

__construct(array $options = array()
Inherited

Parameters

$options

array

Associative array of options

Clean some cache records

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

Available modes are : 'all' (default) => remove all cache entries ($tags is not used) 'old' => unsupported 'matchingTag' => unsupported 'notMatchingTag' => unsupported 'matchingAnyTag' => unsupported

Parameters

$mode

string

clean mode

$tags

array

array of tags

Exceptions

\Zend_Cache_Exception

Returns

booleantrue if no problem

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

getCapabilities() : array

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)
inherited_from \Zend_Cache_Backend_ExtendedInterface::getCapabilities()

Returns

arrayassociative of with capabilities

Return the filling percentage of the backend storage

getFillingPercentage() : integer
inherited_from \Zend_Cache_Backend_ExtendedInterface::getFillingPercentage()

Exceptions

\Zend_Cache_Exception

Returns

integerinteger between 0 and 100

Return an array of stored cache ids

getIds() : array
inherited_from \Zend_Cache_Backend_ExtendedInterface::getIds()

Returns

arrayarray of stored cache ids (string)

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

getIdsMatchingAnyTags(array $tags = array()) : array

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

inherited_from \Zend_Cache_Backend_ExtendedInterface::getIdsMatchingAnyTags()

Parameters

$tags

array

array of tags

Returns

arrayarray of any matching cache ids (string)

Return an array of stored cache ids which match given tags

getIdsMatchingTags(array $tags = array()) : array

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

inherited_from \Zend_Cache_Backend_ExtendedInterface::getIdsMatchingTags()

Parameters

$tags

array

array of tags

Returns

arrayarray of matching cache ids (string)

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

getIdsNotMatchingTags(array $tags = array()) : array

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

inherited_from \Zend_Cache_Backend_ExtendedInterface::getIdsNotMatchingTags()

Parameters

$tags

array

array of tags

Returns

arrayarray of not matching cache ids (string)

Get the life time

getLifetime(integer $specificLifetime) : integer
Inherited

if $specificLifetime is not false, the given specific life time is used else, the global lifetime is used

Parameters

$specificLifetime

integer

Returns

integerCache life time

Return an array of metadatas for the given cache id

getMetadatas(string $id) : array

The array must include these keys :

  • expire : the expire timestamp
  • tags : a string array of tags
  • mtime : timestamp of last modification time
inherited_from \Zend_Cache_Backend_ExtendedInterface::getMetadatas()

Parameters

$id

string

cache id

Returns

arrayarray of metadatas (false if the cache id is not found)

Returns an option

getOption(string $name) : mixed
Inherited

Parameters

$name

string

Optional, the options name to return

Exceptions

\Zend_Cache_Exceptions

Returns

mixed

Return an array of stored tags

getTags() : array
inherited_from \Zend_Cache_Backend_ExtendedInterface::getTags()

Returns

arrayarray of stored tags (string)

Determine system TMP directory and detect if we have read access

getTmpDir() : string
Inherited

inspired from Zend_File_Transfer_Adapter_Abstract

Exceptions

\Zend_Cache_Exception if unable to determine directory

Returns

string

Return true if the automatic cleaning is available for the backend

isAutomaticCleaningAvailable() : boolean

DEPRECATED : use getCapabilities() instead

deprecated
inherited_from \Zend_Cache_Backend::isAutomaticCleaningAvailable()

Returns

boolean

Return true if the automatic cleaning is available for the backend

isAutomaticCleaningAvailable() : boolean
Inherited

DEPRECATED : use getCapabilities() instead

deprecated

Returns

boolean

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

load(string $id, boolean $doNotTestCacheValidity = false) : string

WARNING $doNotTestCacheValidity=true is unsupported by the WinCache backend

Parameters

$id

string

cache id

$doNotTestCacheValidity

boolean

if set to true, the cache validity won't be tested

Returns

stringcached datas (or false)

Remove a cache record

remove(string $id) : boolean

Parameters

$id

string

cache id

Returns

booleantrue if no problem

Save some string datas into a cache record

save(string $data, string $id, array $tags = array(), integer $specificLifetime = false) : boolean

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

Parameters

$data

string

datas to cache

$id

string

cache id

$tags

array

array of strings, the cache record will be tagged by each string entry

$specificLifetime

integer

if != false, set a specific lifetime for this cache record (null => infinite lifetime)

Returns

booleantrue if no problem

Set the frontend directives

setDirectives(array $directives) : void
Inherited

Parameters

$directives

array

Assoc of directives

Exceptions

\Zend_Cache_Exception

Set an option

setOption(string $name, mixed $value) : void
Inherited

Parameters

$name

string

$value

mixed

Exceptions

\Zend_Cache_Exception

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

test(string $id) : mixed

Parameters

$id

string

cache id

Returns

mixedfalse (a cache is not available) or "last modified" timestamp (int) of the available cache record

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

touch(string $id, integer $extraLifetime) : boolean
inherited_from \Zend_Cache_Backend_ExtendedInterface::touch()

Parameters

$id

string

cache id

$extraLifetime

integer

Returns

booleantrue if ok

Verify if the given temporary directory is readable and writable

_isGoodTmpDir(string $dir) : boolean
Inherited

Parameters

$dir

string

temporary directory

Returns

booleantrue if the directory is ok

Log a message at the WARN (4) priority.

_log(string $message, integer $priority = 4) : void
Inherited

Parameters

$message

string

$priority

integer

Make sure if we enable logging that the Zend_Log class is available.

_loggerSanity() : void
Inherited

Create a default log object if none is set.

Exceptions

\Zend_Cache_Exception

 Properties

 

Frontend or Core directives

$_directives : array

Default

array('lifetime' => 3600, 'logging' => false, 'logger' => null)

=====> (int) lifetime :

  • Cache lifetime (in seconds)
  • If null, the cache is valid forever

=====> (int) logging :

  • if set to true, a logging is activated throw Zend_Log
 

Available options

$_options : array

Default

array()

 Constants

 

Log message

TAGS_UNSUPPORTED_BY_CLEAN_OF_WINCACHE_BACKEND = 'Zend_Cache_Backend_WinCache::clean() : tags are unsupported by the WinCache backend' 
 

TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND

TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND = 'Zend_Cache_Backend_WinCache::save() : tags are unsupported by the WinCache backend'