Class Cache_Engine_File

Description

Implements interfaces:

The file system cache engine. Items stored in the file system cache are each stored in separate files and persist between requests. They are dependent on the default expiration mechanism of Cache_Store to clean up unused files.

The file system cache accepts two cache-specific options:

  • cache_dir: The directory to store cache files in
  • cache_file: The exact name (or path) of the cache file to use (default is the key name)

Located in /cache/lib/Cache/Engine/File.php (line 16)


	
			
Class Constant Summary
Variable Summary
 mixed $lockCount
 mixed $locks
 mixed $logger
Method Summary
 static boolean is_supported ()
 void cache_directory ([array $options = null])
 void cache_file_path (string $key, [array $options = null])
 void cleanup ()
 void clear ([array $options = null])
 void escape_file_character ( $matches)
 boolean has_locking ()
 Cache_ItemBase item_for_key (string $key, array $options)
 void logger ()
 string register_lock (resource $lock)
 void safe_file_name ( $str)
 void unregister_lock (string $token)
 void __constructor ()
Variables
mixed $lockCount (line 21)
  • access: protected
mixed $locks (line 22)
  • access: protected
mixed $logger (line 23)
  • access: protected
Methods
static is_supported (line 122)

Called statically to ensure this engine is supported before constructing it. The file engine is always supported.

  • access: public
boolean is_supported ()

Implementation of:
Cache_Engine::is_supported()
Called statically to ensure this engine is supported before constructing it. Most engines will want to always return true, but in some cases it may be a good place to check that all needed extensions are present.
cache_directory (line 132)

Returns the name of the cache directory to use for a given set of options

  • access: public
void cache_directory ([array $options = null])
  • array $options: The options to use for determining the directory
cache_file_path (line 166)

Returns the full cache file path for a given set of options and keys

  • access: public
void cache_file_path (string $key, [array $options = null])
  • string $key: The key to use
  • array $options: The options to use for determining the path
cleanup (line 39)

Clean up locks at shutdown

  • access: public
void cleanup ()
clear (line 71)

Clear all items from the cache

  • access: public
void clear ([array $options = null])
  • array $options: Any cache options provided by the requestor

Implementation of:
Cache_Engine::clear()
Clear all items from the cache
escape_file_character (line 197)

Escape a value for use in a filename

  • access: protected
void escape_file_character ( $matches)
  • $matches
has_locking (line 62)

Returns true to indicate this engine's items provide locking

  • access: public
boolean has_locking ()

Implementation of:
Cache_Engine::has_locking()
Return true if this Engine's items provide locking
item_for_key (line 53)

Return the cache item object for the provided key.

  • access: public
Cache_ItemBase item_for_key (string $key, array $options)
  • string $key: The key to retrieve the item for
  • array $options: Any cache options provided by the requestor

Implementation of:
Cache_Engine::item_for_key()
Return the cache item object for the provided key.
logger (line 204)

Return a logger instance for the class

  • access: public
void logger ()
register_lock (line 145)

Register a lock for cleanup at shutdown

  • return: The lock identifier token
  • access: public
string register_lock (resource $lock)
  • resource $lock: The file handle
safe_file_name (line 182)

Sanitize a string value for use as a filename

  • access: protected
void safe_file_name ( $str)
  • $str
unregister_lock (line 156)

Unregister a released lock passed to register_lock()

  • access: public
void unregister_lock (string $token)
  • string $token: The lock identifier token received from register_lock()
__constructor (line 28)

Constructor

  • access: public
void __constructor ()
Class Constants
FILE_SAMPLE_SIZE = 50 (line 19)
MAX_FILENAME = 150 (line 18)

Documentation generated on Wed, 25 Apr 2012 09:46:42 -0700 by phpDocumentor 1.4.3