## Zend_Cache_Core

Description

- license: New BSD License
- copyright: Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Cache/Core.php (line 27)

Direct descendents

Class | Description
--- | ---
Zend_Cache_Frontend_Class |
Zend_Cache_Frontend_File |
Zend_Cache_Frontend_Function |
Zend_Cache_Frontend_Output |
Zend_Cache_Frontend_Page |

Variable Summary
static mixed $_directivesList
array $_options
mixed $_specificOptions
Method Summary
Zend_Cache_Core __construct ([array $options = array()])
boolean clean ([string $mode = 'all'], [ $tags = array()], mixed $parameters)
mixed get (string $id, [boolean $doNotTestCacheValidity = false], [boolean $doNotUnserialize = false])
boolean remove (string $id)
boolean save (mixed $data, [cache $id = null], [array $tags = array()])
void setBackend (object $backendObject)
void setLifeTime (int $newLifeTime)
void setOption (string $name, mixed $value)
boolean test (string $id)
Variables
static mixed $_directivesList = array('lifeTime', 'logging') (line 86)

Array of options which have to be transfered to backend

- access: protected

array $_options = array(
'writeControl' => true,
'caching' => true,
'automaticSerialization' => false,
'automaticCleaningFactor' => 0,
'lifeTime' => 3600,
'logging' => false
) (line 74)

Available options

====> (boolean) writeControl :

- Enable / disable write control (the cache is read just after writing to detect corrupt entries)
- Enable write control will lightly slow the cache writing but not the cache reading

Write control can detect some corrupt cache files but maybe it's not a perfect control

====> (boolean) caching :

- Enable / disable caching

(can be very usefull for the debug of cached scripts)

====> (boolean) automaticSerialization :

- Enable / disable automatic serialization
- It can be used to save directly datas which aren't strings (but it's slower)

====> (int) automaticCleaningFactor :

- Disable / Tune the automatic cleaning process
- The automatic cleaning process destroy too old (for the given life time) cache files when a new cache file is written : 0 => no automatic cache cleaning 1 => systematic cache cleaning x (integer) > 1 => automatic cleaning randomly 1 times on x cache write

====> (int) lifeTime :

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

====> (boolean) logging :

- If set to true, logging is activated (but the system is slower)

- var: available options
- access: protected

mixed $_specificOptions = array() (line 91)

Not used for the core, just a sort a hint to get a common setOption() method (for the core and for frontends)

- access: protected

Redefined in descendants as:

- Zend_Cache_Frontend_Class::$_specificOptions : Available options
- Zend_Cache_Frontend_File::$_specificOptions : Available options
- Zend_Cache_Frontend_Function::$_specificOptions : This frontend specific options
- Zend_Cache_Frontend_Page::$_specificOptions : This frontend specific options

Methods
Constructor __construct (line 110)

Constructor

- access: public

Zend_Cache_Core __construct ([array $options = array()])

- array $options: associative array of options

Redefined in descendants as:

- Zend_Cache_Frontend_Class::__construct() : Constructor
- Zend_Cache_Frontend_File::__construct() : Constructor
- Zend_Cache_Frontend_Function::__construct() : Constructor
- Zend_Cache_Frontend_Output::__construct() : Constructor
- Zend_Cache_Frontend_Page::__construct() : Constructor

clean (line 328)

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)

- return: true if ok
- access: public

boolean clean ([string $mode = 'all'], [ $tags = array()], mixed $parameters)

- string $mode
- mixed $parameters
- $tags

get (line 207)

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

- return: cached datas (or false)
- access: public

mixed get (string $id, [boolean $doNotTestCacheValidity = false], [boolean $doNotUnserialize = false])

- string $id: cache id
- boolean $doNotTestCacheValidity: if set to true, the cache validity won't be tested
- boolean $doNotUnserialize: do not serialize (even if automaticSerialization is true) => for internal use

Redefined in descendants as:

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

remove (line 304)

Remove a cache

- return: true if ok
- access: public

boolean remove (string $id)

- string $id: cache id to remove

save (line 251)

Save some data in a cache

- return: true if no problem
- access: public

boolean save (mixed $data, [cache $id = null], [array $tags = array()])

- mixed $data: data to put in cache (can be another type than string if automaticSerialization is on)
- cache $id: cache id (if not set, the last cache id will be used)
- array $tags: cache tags

setBackend (line 125)

Set the backend

- access: public

void setBackend (object $backendObject)

- object $backendObject

setLifeTime (line 191)

Force a new lifetime

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

- access: public

void setLifeTime (int $newLifeTime)

- int $newLifeTime: new lifetime (in seconds)

setOption (line 148)

Public frontend to set an option

There is an additional validation (relatively to the protected _setOption method)

- access: public

void setOption (string $name, mixed $value)

- string $name: name of the option
- mixed $value: value of the option

test (line 233)

Test if a cache is available for the given id

- return: true is a cache is available, false else
- access: public

boolean test (string $id)

- string $id: cache id

Redefined in descendants as:

- Zend_Cache_Frontend_File::test() : Test if a cache is available for the given id

Documentation generated on Tue, 11 Jul 2006 12:16:45 -0500 by phpDocumentor 1.3.0RC6