Class Zend_Cache_Core

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

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


	
			
Direct descendents
Variable Summary
 static mixed $_directivesList
 array $_options
Method Summary
 Zend_Cache_Core __construct ([array $options = array()])
 boolean clean ([string $mode = 'all'], [ $tags = array()], mixed $parameters)
 void get ( $id, [ $doNotTestCacheValidity = false], [ $doNotUnserialize = false])
 mixed load (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 87)

Array of options which have to be transfered to backend

  • access: protected
array $_options = array(
'writeControl' => true,
'caching' => true,
'automaticSerialization' => false,
'automaticCleaningFactor' => 10,
'lifeTime' => 3600,
'logging' => false
)
(line 75)

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

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:
Methods
Constructor __construct (line 111)

Constructor

  • access: public
Zend_Cache_Core __construct ([array $options = array()])
  • array $options: associative array of options

Redefined in descendants as:
clean (line 339)

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

THIS METHOD IS DEPRECATED : USE LOAD() INSTEAD (same syntax) !

  • access: public
void get ( $id, [ $doNotTestCacheValidity = false], [ $doNotUnserialize = false])
  • $id
  • $doNotTestCacheValidity
  • $doNotUnserialize
load (line 208)

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 load (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:
remove (line 315)

Remove a cache

  • return: true if ok
  • access: public
boolean remove (string $id)
  • string $id: cache id to remove
save (line 262)

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

Set the backend

  • access: public
void setBackend (object $backendObject)
  • object $backendObject
setLifeTime (line 192)

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

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

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:

Documentation generated on Thu, 18 Jan 2007 09:52:37 -0800 by phpDocumentor 1.3.1