Zend Framework
1.12
|
Public Member Functions | |
__construct ($options=array()) | |
Constructor. | |
setConfig (Zend_Config $config) | |
Set options using an instance of type Zend_Config. | |
setBackend (Zend_Cache_Backend $backendObject) | |
Set the backend. | |
getBackend () | |
Returns the backend. | |
setOption ($name, $value) | |
Public frontend to set an option. | |
getOption ($name) | |
Public frontend to get an option value. | |
setLifetime ($newLifetime) | |
Force a new lifetime. | |
load ($id, $doNotTestCacheValidity=false, $doNotUnserialize=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 for the given id. | |
save ($data, $id=null, $tags=array(), $specificLifetime=false, $priority=8) | |
Save some data in a cache. | |
remove ($id) | |
Remove a cache. | |
clean ($mode= 'all', $tags=array()) | |
Clean cache entries. | |
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. | |
getIds () | |
Return an array of stored cache ids. | |
getTags () | |
Return an array of stored 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. | |
Public Attributes | |
const | BACKEND_NOT_SUPPORTS_TAG = 'tags are not supported by the current backend' |
Messages. | |
const | BACKEND_NOT_IMPLEMENTS_EXTENDED_IF = 'Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available' |
Protected Member Functions | |
_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. | |
_id ($id) | |
Make and return a cache id. | |
Static Protected Member Functions | |
static | _validateIdOrTag ($string) |
Validate a cache id or a tag (security, reliable filenames, reserved prefixes...) | |
static | _validateTagsArray ($tags) |
Validate a tags array (security, reliable filenames, reserved prefixes...) | |
Protected Attributes | |
$_backend = null | |
Backend Object. | |
$_options | |
$_specificOptions = array() | |
Not used for the core, just a sort a hint to get a common setOption() method (for the core and for frontends) | |
$_extendedBackend = false | |
True if the backend implements Zend_Cache_Backend_ExtendedInterface. | |
$_backendCapabilities = array() | |
Static Protected Attributes | |
static | $_directivesList = array('lifetime', 'logging', 'logger') |
Array of options which have to be transfered to backend. | |
__construct | ( | $options = array() | ) |
Constructor.
array | Zend_Config | $options | Associative array of options or Zend_Config instance |
Zend_Cache_Exception |
|
protected |
Make and return a cache id.
Checks 'cache_id_prefix' and returns new id with prefix or simply the id if null
string | $id | Cache id |
|
protected |
Log a message at the WARN (4) priority.
string | $message |
Zend_Cache_Exception |
|
protected |
Make sure if we enable logging that the Zend_Log class is available.
Create a default log object if none is set.
Zend_Cache_Exception |
|
staticprotected |
Validate a cache id or a tag (security, reliable filenames, reserved prefixes...)
Throw an exception if a problem is found
string | $string | Cache id or tag |
Zend_Cache_Exception |
|
staticprotected |
Validate a tags array (security, reliable filenames, reserved prefixes...)
Throw an exception if a problem is found
array | $tags | Array of tags |
Zend_Cache_Exception |
clean | ( | $mode = 'all' , |
|
$tags = array() |
|||
) |
Clean cache entries.
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)
string | $mode | |
array | string | $tags |
Zend_Cache_Exception |
getBackend | ( | ) |
Returns the backend.
getFillingPercentage | ( | ) |
Return the filling percentage of the backend storage.
getIds | ( | ) |
Return an array of stored cache ids.
getIdsMatchingAnyTags | ( | $tags = array() | ) |
Return an array of stored cache ids which match any given tags.
In case of multiple tags, a logical OR is made between tags
array | $tags | array of tags |
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
array | $tags | array of tags |
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
array | $tags | array of tags |
getMetadatas | ( | $id | ) |
Return an array of metadatas for the given cache id.
The array will include these keys :
string | $id | cache id |
getOption | ( | $name | ) |
Public frontend to get an option value.
string | $name | Name of the option |
Zend_Cache_Exception |
getTags | ( | ) |
Return an array of stored tags.
load | ( | $id, | |
$doNotTestCacheValidity = false , |
|||
$doNotUnserialize = false |
|||
) |
Test if a cache is available for the given id and (if yes) return it (false else)
string | $id | Cache id |
boolean | $doNotTestCacheValidity | If set to true, the cache validity won't be tested |
boolean | $doNotUnserialize | Do not serialize (even if automatic_serialization is true) => for internal use |
remove | ( | $id | ) |
Remove a cache.
string | $id | Cache id to remove |
save | ( | $data, | |
$id = null , |
|||
$tags = array() , |
|||
$specificLifetime = false , |
|||
$priority = 8 |
|||
) |
Save some data in a cache.
mixed | $data | Data to put in cache (can be another type than string if automatic_serialization is on) |
string | $id | Cache id (if not set, the last cache id will be used) |
array | $tags | Cache tags |
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 |
Zend_Cache_Exception |
setBackend | ( | Zend_Cache_Backend | $backendObject | ) |
Set the backend.
Zend_Cache_Backend | $backendObject |
Zend_Cache_Exception |
setConfig | ( | Zend_Config | $config | ) |
Set options using an instance of type Zend_Config.
Zend_Config | $config |
setLifetime | ( | $newLifetime | ) |
Force a new lifetime.
The new value is set for the core/frontend but for the backend too (directive)
int | $newLifetime | New lifetime (in seconds) |
setOption | ( | $name, | |
$value | |||
) |
Public frontend to set an option.
There is an additional validation (relatively to the protected _setOption method)
string | $name | Name of the option |
mixed | $value | Value of the option |
Zend_Cache_Exception |
test | ( | $id | ) |
Test if a cache is available for the given id.
string | $id | Cache id |
touch | ( | $id, | |
$extraLifetime | |||
) |
Give (if possible) an extra lifetime to the given cache id.
string | $id | cache id |
int | $extraLifetime |
|
protected |
Backend Object.
|
protected |
|
staticprotected |
Array of options which have to be transfered to backend.
|
protected |
True if the backend implements Zend_Cache_Backend_ExtendedInterface.
|
protected |
|
protected |
Not used for the core, just a sort a hint to get a common setOption() method (for the core and for frontends)
const BACKEND_NOT_IMPLEMENTS_EXTENDED_IF = 'Current backend doesn\'t implement the Zend_Cache_Backend_ExtendedInterface, so this method is not available' |
const BACKEND_NOT_SUPPORTS_TAG = 'tags are not supported by the current backend' |
Messages.