Class Zend_Cache_Core

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

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


	
			
Direct descendents
Variable Summary
Method Summary
 void __construct ([ $options = array()])
 boolean clean ([string $mode = 'all'], [array|string $tags = array()])
 object backend getBackend ()
 array getIds ()
 array getIdsMatchingTags ([array $tags = array()])
 array getIdsNotMatchingTags ([array $tags = array()])
 mixed getOption (string $name)
 array getTags ()
 mixed|false load (string $id, [boolean $doNotTestCacheValidity = false], [boolean $doNotUnserialize = false])
 boolean remove (string $id)
 boolean save (mixed $data, [string $id = null], [array $tags = array()], [int $specificLifetime = false], [int $priority = 8])
 void setBackend (Zend_Cache_Backend $backendObject)
 void setLifetime (int $newLifetime)
 void setOption (string $name, mixed $value)
 boolean test (string $id)
 boolean touch (string $id, int $extraLifetime)
 void _log (string $message, [ $priority = 4])
 void _loggerSanity ()
Variables
static array $_directivesList = array('lifetime', 'logging', 'logger') (line 93)

Array of options which have to be transfered to backend

  • access: protected
object $_backend = null (line 34)

Backend Object

  • access: protected
array $_backendCapabilities = array() (line 121)

Array of capabilities of the backend (only if it implements Zend_Cache_Backend_ExtendedInterface)

  • access: protected
boolean $_extendedBackend = false (line 114)

True if the backend implements Zend_Cache_Backend_ExtendedInterface

  • access: protected
array $_options = array(
'write_control' => true,
'caching' => true,
'cache_id_prefix' => null,
'automatic_serialization' => false,
'automatic_cleaning_factor' => 10,
'lifetime' => 3600,
'logging' => false,
'logger' => null,
'ignore_user_abort' => false
)
(line 76)

Available options

====> (boolean) write_control :

  • 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 useful for the debug of cached scripts)

=====> (string) cache_id_prefix :

  • prefix for cache ids (namespace)
====> (boolean) automatic_serialization :
  • Enable / disable automatic serialization
  • It can be used to save directly datas which aren't strings (but it's slower)
====> (int) automatic_cleaning_factor :
  • 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)
====> (boolean) ignore_user_abort
  • If set to true, the core will set the ignore_user_abort PHP flag inside the save() method to avoid cache corruptions in some cases (default false)

  • var: available options
  • access: protected
array $_specificOptions = array() (line 100)

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

Constructor

  • throws: Zend_Cache_Exception
  • access: public
void __construct ([ $options = array()])
  • array $options: Associative array of options

Redefined in descendants as:
clean (line 416)

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)

  • return: True if ok
  • throws: Zend_Cache_Exception
  • access: public
boolean clean ([string $mode = 'all'], [array|string $tags = array()])
  • string $mode
  • array|string $tags
getBackend (line 167)

Returns the backend

  • return: object
  • access: public
object backend getBackend ()
getFillingPercentage (line 504)

Return the filling percentage of the backend storage

  • return: integer between 0 and 100
  • access: public
int getFillingPercentage ()
getIds (line 475)

Return an array of stored cache ids

  • return: array of stored cache ids (string)
  • access: public
array getIds ()
getIdsMatchingTags (line 440)

Return an array of stored cache ids which match given tags

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

  • return: array of matching cache ids (string)
  • access: public
array getIdsMatchingTags ([array $tags = array()])
  • array $tags: array of tags
getIdsNotMatchingTags (line 459)

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

  • return: array of not matching cache ids (string)
  • access: public
array getIdsNotMatchingTags ([array $tags = array()])
  • array $tags: array of tags
getOption (line 207)

Public frontend to get an option value

  • return: option value
  • throws: Zend_Cache_Exception
  • access: public
mixed getOption (string $name)
  • string $name: Name of the option
getTags (line 488)

Return an array of stored tags

  • return: array of stored tags (string)
  • access: public
array getTags ()
load (line 263)

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

  • return: Cached datas
  • access: public
mixed|false 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 automatic_serialization is true) => for internal use

Redefined in descendants as:
remove (line 388)

Remove a cache

  • return: True if ok
  • access: public
boolean remove (string $id)
  • string $id: Cache id to remove
save (line 311)

Save some data in a cache

  • return: True if no problem
  • throws: Zend_Cache_Exception
  • access: public
boolean save (mixed $data, [string $id = null], [array $tags = array()], [int $specificLifetime = false], [int $priority = 8])
  • 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
setBackend (line 145)

Set the backend

  • throws: Zend_Cache_Exception
  • access: public
void setBackend (Zend_Cache_Backend $backendObject)
  • object $backendObject
setLifetime (line 247)

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

Public frontend to set an option

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

  • throws: Zend_Cache_Exception
  • access: public
void setOption (string $name, mixed $value)
  • string $name: Name of the option
  • mixed $value: Value of the option

Redefined in descendants as:
test (line 289)

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:
touch (line 519)

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

  • return: true if ok
  • access: public
boolean touch (string $id, int $extraLifetime)
  • string $id: cache id
  • int $extraLifetime
_log (line 600)

Log a message at the WARN (4) priority.

  • throws: Zend_Cache_Exception
  • access: protected
void _log (string $message, [ $priority = 4])
  • string $message
  • $priority
_loggerSanity (line 577)

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

Create a default log object if none is set.

  • throws: Zend_Cache_Exception
  • access: protected
void _loggerSanity ()

Documentation generated on Fri, 08 Jan 2010 17:15:52 -0500 by phpDocumentor 1.4.3