Impementation of Zend Cache Backend using the Zend Platform (Output Content Caching)

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 Validate that the Zend Platform is loaded and licensed

__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 : 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) This mode is not supported in this backend 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 => unsupported 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)

inherited_from \Zend_Cache_Backend_Interface::clean()

Parameters

$mode

string

Clean mode

$tags

array

Array of tags

Exceptions

\Zend_Cache_Exception

Returns

booleanTrue if no problem

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

Returns an option

getOption(string $name) : mixed
Inherited

Parameters

$name

string

Optional, the options name to return

Exceptions

\Zend_Cache_Exceptions

Returns

mixed

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
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

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

inherited_from \Zend_Cache_Backend_Interface::load()

Parameters

$id

string

Cache id

$doNotTestCacheValidity

boolean

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

Returns

stringCached data (or false)

Remove a cache record

remove(string $id) : boolean
inherited_from \Zend_Cache_Backend_Interface::remove()

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)

inherited_from \Zend_Cache_Backend_Interface::save()

Parameters

$data

string

Data 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 | false
inherited_from \Zend_Cache_Backend_Interface::test()

Parameters

$id

string

Cache id

Returns

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

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

Clean a directory and recursivly go over it's subdirectories

_clean(string $dir, string $mode) : boolean

Remove all the cached files that need to be cleaned (according to mode and files mtime)

Parameters

$dir

string

Path of directory ot clean

$mode

string

The same parameter as in Zend_Cache_Backend_ZendPlatform::clean()

Returns

booleanTrue if ok

Remove a file

_remove(string $file) : boolean

If we can't remove the file (because of locks or any problem), we will touch the file to invalidate it

Parameters

$file

string

Complete file path

Returns

booleanTrue if ok

 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

 

internal ZP prefix

TAGS_PREFIX = "internal_ZPtag:"