Class Zend_Cache_Backend_File

Description

Implements interfaces:

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

Located in /Cache/Backend/File.php (line 41)

Zend_Cache_Backend
   |
   --Zend_Cache_Backend_File
Variable Summary
Method Summary
 Zend_Cache_Backend_File __construct ([array $options = array()])
 boolean clean ([string $mode = Zend_Cache::CLEANING_MODE_ALL], [tags $tags = array()])
 string load (string $id, [boolean $doNotTestCacheValidity = false])
 boolean remove (string $id)
 boolean save (string $data, string $id, [array $tags = array()], [int $specificLifetime = false])
 void setCacheDir (mixed $value)
 mixed test (string $id)
 void ___expire (string $id)
Variables
array $_backwardCompatibilityArray = array(
'cacheDir' => 'cache_dir',
'fileLocking' => 'file_locking',
'readControl' => 'read_control',
'readControlType' => 'read_control_type',
'hashedDirectoryLevel' => 'hashed_directory_level',
'hashedDirectoryUmask' => 'hashed_directory_umask',
'fileNamePrefix' => 'file_name_prefix'
)
(line 103)

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

  • access: protected

Redefinition of:
Zend_Cache_Backend::$_backwardCompatibilityArray
backward compatibility becase of ZF-879 and ZF-1172 (it will be removed in ZF 1.1)
array $_options = array(
'cache_dir' => null,
'file_locking' => true,
'read_control' => true,
'read_control_type' => 'crc32',
'hashed_directory_level' => 0,
'hashed_directory_umask' => 0700,
'file_name_prefix' => 'zend_cache'
)
(line 88)

Available options

=====> (string) cache_dir :

  • Directory where to put the cache files
=====> (boolean) file_locking :
  • Enable / disable file_locking
  • Can avoid cache corruption under bad circumstances but it doesn't work on multithread
webservers and on NFS filesystems for example

=====> (boolean) read_control :

  • Enable / disable read control
  • If enabled, a control key is embeded in cache file and this key is compared with the one
calculated after the reading.

=====> (string) read_control_type :

  • Type of read control (only if read control is enabled). Available values are : 'md5' for a md5 hash control (best but slowest) 'crc32' for a crc32 hash control (lightly less safe but faster, better choice) 'strlen' for a length only test (fastest)
=====> (int) hashed_directory_level :
  • Hashed directory level
  • Set the hashed directory structure level. 0 means "no hashed directory
structure", 1 means "one level of directory", 2 means "two levels"... This option can speed up the cache only when you have many thousands of cache file. Only specific benchs can help you to choose the perfect value for you. Maybe, 1 or 2 is a good start.

=====> (int) hashed_directory_umask :

  • Umask for hashed directory structure
=====> (string) file_name_prefix :
  • prefix for cache files
  • be really carefull with this option because a too generic value in a system cache dir (like /tmp) can cause disasters when cleaning the cache

  • var: available options
  • access: protected

Redefinition of:
Zend_Cache_Backend::$_options
Available options

Inherited Variables

Inherited from Zend_Cache_Backend

Zend_Cache_Backend::$_directives
Methods
Constructor __construct (line 122)

Constructor

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

Redefinition of:
Zend_Cache_Backend::__construct()
Constructor
clean (line 303)

Clean some cache records

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 no problem
  • access: public
boolean clean ([string $mode = Zend_Cache::CLEANING_MODE_ALL], [tags $tags = array()])
  • string $mode: clean mode
  • tags $tags: array $tags array of tags

Implementation of:
Zend_Cache_Backend_Interface::clean()
Clean some cache records
load (line 156)

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

  • return: cached datas (or false)
  • access: public
string load (string $id, [boolean $doNotTestCacheValidity = false])
  • string $id: cache id
  • boolean $doNotTestCacheValidity: if set to true, the cache validity won't be tested

Implementation of:
Zend_Cache_Backend_Interface::load()
Test if a cache is available for the given id and (if yes) return it (false else)
remove (line 274)

Remove a cache record

  • return: true if no problem
  • access: public
boolean remove (string $id)
  • string $id: cache id

Implementation of:
Zend_Cache_Backend_Interface::remove()
Remove a cache record
save (line 220)

Save some string datas into a cache record

Note : $data is always "string" (serialization is done by the core not by the backend)

  • return: true if no problem
  • access: public
boolean save (string $data, string $id, [array $tags = array()], [int $specificLifetime = false])
  • string $data: datas to cache
  • string $id: cache id
  • array $tags: array of strings, the cache record will be tagged by each string entry
  • int $specificLifetime: if != false, set a specific lifetime for this cache record (null => infinite lifetime)

Implementation of:
Zend_Cache_Backend_Interface::save()
Save some string datas into a cache record
setCacheDir (line 142)

Set the cache_dir (particular case of setOption() method)

  • access: public
void setCacheDir (mixed $value)
  • mixed $value
test (line 203)

Test if a cache is available or not (for the given id)

  • return: false (a cache is not available) or "last modified" timestamp (int) of the available cache record
  • access: public
mixed test (string $id)
  • string $id: cache id

Implementation of:
Zend_Cache_Backend_Interface::test()
Test if a cache is available or not (for the given id)
___expire (line 317)

PUBLIC METHOD FOR UNIT TESTING ONLY !

Force a cache record to expire

  • access: public
void ___expire (string $id)
  • string $id: cache id

Inherited Methods

Inherited From Zend_Cache_Backend

 Zend_Cache_Backend::__construct()
 Zend_Cache_Backend::getLifetime()
 Zend_Cache_Backend::getTmpDir()
 Zend_Cache_Backend::isAutomaticCleaningAvailable()
 Zend_Cache_Backend::setDirectives()
 Zend_Cache_Backend::setOption()
 Zend_Cache_Backend::_log()
 Zend_Cache_Backend::_loggerSanity()

Documentation generated on Wed, 28 Nov 2007 15:46:10 -0600 by phpDocumentor 1.4.0