Class Zend_Cache_Core

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

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


	
			
Direct descendents
Variable Summary
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()], [int $specificLifetime = false])
 void setBackend (object $backendObject)
 void setLifetime (int $newLifetime)
 void setOption (string $name, mixed $value)
 boolean test (string $id)
 void _log (string $message, [ $priority = 4])
 void _loggerSanity ()
Variables
static mixed $_directivesList = array('lifetime', 'logging', 'logger') (line 88)

Array of options which have to be transfered to backend

  • access: protected
array $_backwardCompatibilityArray = array(
'lifeTime' => 'lifetime',
'writeControl' => 'write_control',
'automaticSerialization' => 'automatic_serialization',
'automaticCleaningFactor' => 'automatic_cleaning_factor',
'cachedEntity' => 'cached_entity',
'cacheByDefault' => 'cache_by_default',
'cachedMethods' => 'cached_methods',
'nonCachedMethods' => 'non_cached_methods',
'cachedFunctions' => 'cached_functions',
'nonCachedFunctions' => 'non_cached_functions',
'masterFile' => 'master_file',
'httpConditional' => 'http_conditional',
'debugHeader' => 'debug_header',
'defaultOptions' => 'default_options',
'cacheWithGetVariables' => 'cache_with_get_variables',
'cacheWithPostVariables' => 'cache_with_post_variables',
'cacheWithSessionVariables' => 'cache_with_session_variables',
'cacheWithFilesVariables' => 'cache_with_files_variables',
'cacheWithCookieVariables' => 'cache_with_cookie_variables',
'makeIdWithGetVariables' => 'make_id_with_get_variables',
'makeIdWithPostVariables' => 'make_id_with_post_variables',
'makeIdWithSessionVariables' => 'make_id_with_session_variables',
'makeIdWithFilesVariables' => 'make_id_with_files_variables',
'makeIdWithCookieVariables' => 'make_id_with_cookie_variables'
)
(line 107)

backward compatibility becase of ZF-879 and ZF-1172 (it will be removed in ZF 1.1)

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

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

====> (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)

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

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

Constructor

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

Redefined in descendants as:
clean (line 373)

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

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

it will be removed in ZF 1.1 !

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

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 automatic_serialization is true) => for internal use

Redefined in descendants as:
remove (line 349)

Remove a cache

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

Save some data in a cache

  • return: true if no problem
  • access: public
boolean save (mixed $data, [cache $id = null], [array $tags = array()], [int $specificLifetime = false])
  • mixed $data: data to put in cache (can be another type than string if automatic_serialization is on)
  • cache $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)
setBackend (line 159)

Set the backend

  • access: public
void setBackend (object $backendObject)
  • object $backendObject
setLifetime (line 227)

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)

  • access: public
void setOption (string $name, mixed $value)
  • string $name: name of the option
  • mixed $value: value of the option
test (line 279)

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:
_log (line 462)

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

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 Sun, 27 May 2007 23:21:53 -0700 by phpDocumentor 1.3.2