API Documentation

Cache/Frontend/Class.php

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Cache  
subpackage
Zend_Cache_Frontend  
version
$Id: Class.php 24032 2011-05-10 21:08:20Z mabe $  

\Zend_Cache_Frontend_Class

Extends from
\Zend_Cache_Core
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Cache  
subpackage
Zend_Cache_Frontend  

Properties

Propertyprivatemixed  $_cachedEntity= 'null'

The cached object or the name of the cached abstract class

Default valuenullDetails
Type
mixed
Propertyprivatestring  $_cachedEntityLabel= ''

The class name of the cached object or cached abstract class

Used to differentiate between different classes with the same method calls.

Details
Type
string
Propertyprivateint  $_priority= '8'

Priority (used by some particular backends)

Default value8Details
Type
int
Propertyprivateint  $_specificLifetime= 'false'

SpecificLifetime value

false => no specific life time

Default valuefalseDetails
Type
int
Propertyprotectedarray  $_specificOptions= 'array'

Available options

available options

====> (mixed) cached_entity : - if set to a class name, we will cache an abstract class and will use only static calls - if set to an object, we will cache this object methods

====> (boolean) cache_by_default : - if true, method calls will be cached by default

====> (array) cached_methods : - an array of method names which will be cached (even if cache_by_default = false)

====> (array) non_cached_methods : - an array of method names which won't be cached (even if cache_by_default = true)

Default valuearrayDetails
Type
array
Propertyprivatearray  $_tags= 'array'

Tags array

Default valuearrayDetails
Type
array

Methods

methodpublic__call( string $name, array $parameters ) : mixed

Main method : call the specified method or get the result from cache

Parameters
Name Type Description
$name string Method name
$parameters array Method parameters
Returns
Type Description
mixed Result
methodpublic__construct( array $options = array ) : void

Constructor

Parameters
Name Type Description
$options array Associative array of options
Throws
Exception Description
\Zend_Cache_Exception
methodprotected_id( string $id ) : string

Make and return a cache id

Inherited from: \Zend_Cache_Core::_id()

Checks 'cache_id_prefix' and returns new id with prefix or simply the id if null

Parameters
Name Type Description
$id string Cache id
Returns
Type Description
string Cache id (with or without prefix)
methodprotected_log( string $message,  $priority = 4 ) : void

Log a message at the WARN (4) priority.

Inherited from: \Zend_Cache_Core::_log()
Parameters
Name Type Description
$message string
$priority
Throws
Exception Description
\Zend_Cache_Exception
methodprotected_loggerSanity( ) : void

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

Inherited from: \Zend_Cache_Core::_loggerSanity()

Create a default log object if none is set.

Throws
Exception Description
\Zend_Cache_Exception
methodprivate_makeId(  $name,  $args ) : void

ZF-9970

Parameters
Name Type Description
$name
$args
Details
deprecated
 
methodprivate_setOption( string $name, mixed $value ) : void

Set an option

Inherited from: \Zend_Cache_Core::_setOption()
Parameters
Name Type Description
$name string Name of the option
$value mixed Value of the option
Throws
Exception Description
\Zend_Cache_Exception
methodprotected_validateIdOrTag( string $string ) : void
static

Validate a cache id or a tag (security, reliable filenames, reserved prefixes...)

Inherited from: \Zend_Cache_Core::_validateIdOrTag()

Throw an exception if a problem is found

Parameters
Name Type Description
$string string Cache id or tag
Throws
Exception Description
\Zend_Cache_Exception
methodprotected_validateTagsArray( array $tags ) : void
static

Validate a tags array (security, reliable filenames, reserved prefixes...)

Inherited from: \Zend_Cache_Core::_validateTagsArray()

Throw an exception if a problem is found

Parameters
Name Type Description
$tags array Array of tags
Throws
Exception Description
\Zend_Cache_Exception
methodpublicclean( string $mode = all, array|string $tags = array ) : boolean

Clean cache entries

Inherited from: \Zend_Cache_Core::clean()

Available modes are : 'all' (default) => remove all cache entries ($tags is not used) 'old' => remove too old cache entries ($tags is not used) 'matchingTag' => remove cache entries matching all given tags ($tags can be an array of strings or a single string) 'notMatchingTag' => remove cache entries not matching one of the given tags ($tags can be an array of strings or a single string) 'matchingAnyTag' => remove cache entries matching any given tags ($tags can be an array of strings or a single string)

Parameters
Name Type Description
$mode string
$tags array|string
Returns
Type Description
boolean True if ok
Throws
Exception Description
\Zend_Cache_Exception
methodpublicgetBackend( ) : \Zend_Cache_Backend

Returns the backend

Inherited from: \Zend_Cache_Core::getBackend()
Returns
Type Description
\Zend_Cache_Backend backend object
methodpublicgetFillingPercentage( ) : int

Return the filling percentage of the backend storage

Inherited from: \Zend_Cache_Core::getFillingPercentage()
Returns
Type Description
int integer between 0 and 100
methodpublicgetIds( ) : array

Return an array of stored cache ids

Inherited from: \Zend_Cache_Core::getIds()
Returns
Type Description
array array of stored cache ids (string)
methodpublicgetIdsMatchingAnyTags( array $tags = array ) : array

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

Inherited from: \Zend_Cache_Core::getIdsMatchingAnyTags()

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

Parameters
Name Type Description
$tags array array of tags
Returns
Type Description
array array of matching any cache ids (string)
methodpublicgetIdsMatchingTags( array $tags = array ) : array

Return an array of stored cache ids which match given tags

Inherited from: \Zend_Cache_Core::getIdsMatchingTags()

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

Parameters
Name Type Description
$tags array array of tags
Returns
Type Description
array array of matching cache ids (string)
methodpublicgetIdsNotMatchingTags( array $tags = array ) : array

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

Inherited from: \Zend_Cache_Core::getIdsNotMatchingTags()

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

Parameters
Name Type Description
$tags array array of tags
Returns
Type Description
array array of not matching cache ids (string)
methodpublicgetMetadatas( string $id ) : array

Return an array of metadatas for the given cache id

Inherited from: \Zend_Cache_Core::getMetadatas()

The array will include these keys : - expire : the expire timestamp - tags : a string array of tags - mtime : timestamp of last modification time

Parameters
Name Type Description
$id string cache id
Returns
Type Description
array array of metadatas (false if the cache id is not found)
methodpublicgetOption( string $name ) : mixed

Public frontend to get an option value

Inherited from: \Zend_Cache_Core::getOption()
Parameters
Name Type Description
$name string Name of the option
Returns
Type Description
mixed option value
Throws
Exception Description
\Zend_Cache_Exception
methodpublicgetTags( ) : array

Return an array of stored tags

Inherited from: \Zend_Cache_Core::getTags()
Returns
Type Description
array array of stored tags (string)
methodpublicload( string $id, boolean $doNotTestCacheValidity = false, boolean $doNotUnserialize = false ) : mixed|false

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

Inherited from: \Zend_Cache_Core::load()
Parameters
Name Type Description
$id string Cache id
$doNotTestCacheValidity boolean

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

$doNotUnserialize boolean

Do not serialize (even if automatic_serialization is true) => for internal use

Returns
Type Description
mixedfalse Cached datas
methodpublicmakeId( string $name, array $args = array ) : string

Make a cache id from the method name and parameters

Parameters
Name Type Description
$name string Method name
$args array Method parameters
Returns
Type Description
string Cache id
methodpublicremove( string $id ) : boolean

Remove a cache

Inherited from: \Zend_Cache_Core::remove()
Parameters
Name Type Description
$id string Cache id to remove
Returns
Type Description
boolean True if ok
methodpublicsave( mixed $data, string $id = null, array $tags = array, int $specificLifetime = false, int $priority = 8 ) : boolean

Save some data in a cache

Inherited from: \Zend_Cache_Core::save()
Parameters
Name Type Description
$data mixed

Data to put in cache (can be another type than string if automatic_serialization is on)

$id string

Cache id (if not set, the last cache id will be used)

$tags array Cache tags
$specificLifetime int

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

$priority int

integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends

Returns
Type Description
boolean True if no problem
Throws
Exception Description
\Zend_Cache_Exception
methodpublicsetBackend( \Zend_Cache_Backend $backendObject ) : void

Set the backend

Inherited from: \Zend_Cache_Core::setBackend()
Parameters
Name Type Description
$backendObject \Zend_Cache_Backend
Throws
Exception Description
\Zend_Cache_Exception
methodpublicsetCachedEntity( mixed $cachedEntity ) : void

Specific method to set the cachedEntity

if set to a class name, we will cache an abstract class and will use only static calls if set to an object, we will cache this object methods

Parameters
Name Type Description
$cachedEntity mixed
methodpublicsetConfig( \Zend_Config $config ) : \Zend_Cache_Core

Set options using an instance of type Zend_Config

Inherited from: \Zend_Cache_Core::setConfig()
Parameters
Name Type Description
$config \Zend_Config
Returns
Type Description
\Zend_Cache_Core
methodpublicsetLifetime( int $newLifetime ) : void

Force a new lifetime

Inherited from: \Zend_Cache_Core::setLifetime()

The new value is set for the core/frontend but for the backend too (directive)

Parameters
Name Type Description
$newLifetime int

New lifetime (in seconds)

methodpublicsetOption( string $name, mixed $value ) : void

Public frontend to set an option

Just a wrapper to get a specific behaviour for cached_entity

Parameters
Name Type Description
$name string Name of the option
$value mixed Value of the option
Throws
Exception Description
\Zend_Cache_Exception
methodpublicsetPriority( int $priority ) : void

Set the priority (used by some particular backends)

Parameters
Name Type Description
$priority int

integer between 0 (very low priority) and 10 (maximum priority)

methodpublicsetSpecificLifetime( int $specificLifetime = false ) : void

Set a specific life time

Parameters
Name Type Description
$specificLifetime int
methodpublicsetTagsArray( array $tags = array ) : void

Set the cache array

Parameters
Name Type Description
$tags array
methodpublictest( string $id ) : int|false

Test if a cache is available for the given id

Inherited from: \Zend_Cache_Core::test()
Parameters
Name Type Description
$id string Cache id
Returns
Type Description
intfalse Last modified time of cache entry if it is available, false otherwise
methodpublictouch( string $id, int $extraLifetime ) : boolean

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

Inherited from: \Zend_Cache_Core::touch()
Parameters
Name Type Description
$id string cache id
$extraLifetime int
Returns
Type Description
boolean true if ok
Documentation was generated by DocBlox 0.13.3.