Class xPDOCacheManager

Description

The default cache manager implementation for xPDO.

Located in /cache/xpdocachemanager.class.php (line 34)


	
			
Class Constant Summary
 CACHE_DIR = 'objects/'
 CACHE_PHP = 0
 LOG_DIR = 'logs/'
Variable Summary
 mixed $caches
 mixed $options
 mixed $xpdo
 mixed $_umask
Method Summary
 void add (string $key, mixed &$var, [integer $lifetime = 0], [array $options = array()])
 xPDOCacheManager __construct ( &$xpdo, [ $options = array()])
 boolean clean ([array $options = array()])
 boolean|array copyFile (string $source, string $target, [array $options = array()])
 array|boolean copyTree (string $source, string $target, [array $options = array()])
 boolean delete (string $key, [array $options = array()])
 boolean deleteTree (string $dirname, [array $options = array('deleteTop' => false, 'skipDirs' => false, 'extensions' => array('.cache.php'))])
 boolean endsWith (string $string, string|array $pattern)
 string escapeSingleQuotes (string $s)
 string generateObject (xPDOObject $obj, string $objName, [boolean $generateObjVars = false], [boolean $generateRelated = false], [string $objRef = 'this->xpdo'], [boolean $format = xPDOCacheManager::CACHE_PHP])
 mixed get (string $key, [array $options = array()])
 string getCachePath ()
 void &getCacheProvider ([ $key = ''], [ $options = array()])
 integer getFilePermissions ()
 mixed getOption (string $key, [array $options = array()], [mixed $default = null])
 boolean matches (string $string, string|array $pattern)
 boolean replace (string $key, mixed &$var, [integer $lifetime = 0], [array $options = array()])
 boolean set (string $key, mixed &$var, [integer $lifetime = 0], [array $options = array()])
 boolean writeFile (string $filename, string $content, [string $mode = 'wb'], [array $options = array()])
 boolean writeTree (string $dirname, [array $options = array()])
Variables
mixed $caches = array() (line 41)
  • access: protected
mixed $options = array() (line 42)
  • access: protected
mixed $xpdo = null (line 40)
  • access: protected
mixed $_umask = null (line 43)
  • access: protected
Methods
add (line 543)

Add a key-value pair to a cache provider if it does not already exist.

  • access: public
void add (string $key, mixed &$var, [integer $lifetime = 0], [array $options = array()])
  • string $key: A unique key identifying the item being stored.
  • integer $lifetime: Seconds the item will be valid in cache.
  • array $options: Additional options for the cache add operation.
  • mixed &$var: & $var A reference to the PHP variable representing the item.
Constructor __construct (line 45)
  • access: public
xPDOCacheManager __construct ( &$xpdo, [ $options = array()])
  • &$xpdo
  • $options
clean (line 646)

Flush the contents of a cache provider.

  • return: True if the flush was successful.
  • access: public
boolean clean ([array $options = array()])
  • array $options: Additional options for the cache flush.
copyFile (line 259)

Copies a file from a source file to a target directory.

  • return: Returns true if the copy operation was successful, or a single element array with filename as key and stat results of the successfully copied file as a result.
  • access: public
boolean|array copyFile (string $source, string $target, [array $options = array()])
  • string $source: The absolute path of the source file.
  • string $target: The absolute path of the target destination directory.
  • array $options: An array of options for this function.
copyTree (line 302)

Recursively copies a directory tree from a source directory to a target directory.

  • return: Returns an array of all files and folders that were copied or false.
  • access: public
array|boolean copyTree (string $source, string $target, [array $options = array()])
  • string $source: The absolute path of the source directory.
  • string $target: The absolute path of the target destination directory.
  • array $options: An array of options for this function.
delete (line 615)

Delete a key-value pair from a cache provider.

  • return: True if the deletion was successful.
  • access: public
boolean delete (string $key, [array $options = array()])
  • string $key: A unique key identifying the item being deleted.
  • array $options: Additional options for the cache deletion.
deleteTree (line 374)

Recursively deletes a directory tree of files.

  • return: Returns true if the deletion was successful.
  • access: public
boolean deleteTree (string $dirname, [array $options = array('deleteTop' => false, 'skipDirs' => false, 'extensions' => array('.cache.php'))])
  • string $dirname: An absolute path to the source directory to delete.
  • array $options: An array of options for this function.
endsWith (line 444)

Sees if a string ends with a specific pattern or set of patterns.

  • return: True if the string ends with the pattern or any of the patterns provided.
  • access: public
boolean endsWith (string $string, string|array $pattern)
  • string $string: The string to check.
  • string|array $pattern: The pattern or an array of patterns to check against.
escapeSingleQuotes (line 661)

Escapes all single quotes in a string

  • return: The string with single quotes escaped.
  • access: public
string escapeSingleQuotes (string $s)
  • string $s: The string to escape single quotes in.
generateObject (line 507)

Generate a PHP executable representation of an xPDOObject.

  • return: The source map file, in string format.
  • todo: Add stdObject support.
  • todo: Complete $generateRelated functionality.
  • access: public
string generateObject (xPDOObject $obj, string $objName, [boolean $generateObjVars = false], [boolean $generateRelated = false], [string $objRef = 'this->xpdo'], [boolean $format = xPDOCacheManager::CACHE_PHP])
  • xPDOObject $obj: An xPDOObject to generate the cache file for
  • string $objName: The name of the xPDOObject
  • boolean $generateObjVars: If true, will also generate maps for all object variables. Defaults to false.
  • boolean $generateRelated: If true, will also generate maps for all related objects. Defaults to false.
  • string $objRef: The reference to the xPDO instance, in string format.
  • boolean $format: The format to cache in. Defaults to xPDOCacheManager::CACHE_PHP, which is set to cache in executable PHP format.
get (line 631)

Get a value from a cache provider by key.

  • return: The value of the object cache key
  • access: public
mixed get (string $key, [array $options = array()])
  • string $key: A unique key identifying the item being retrieved.
  • array $options: Additional options for the cache retrieval.
getCachePath (line 141)

Get the absolute path to a writable directory for storing files.

  • return: The absolute path of the xPDO cache directory.
  • access: public
string getCachePath ()
getCacheProvider (line 54)

Get an instance of a provider which implements the xPDOCache interface.

  • access: public
void &getCacheProvider ([ $key = ''], [ $options = array()])
  • $key
  • $options
getFilePermissions (line 129)

Get default file permissions based on umask

  • return: The default file permissions.
  • access: public
integer getFilePermissions ()
getFolderPermissions (line 118)

Get default folder permissions based on umask

  • return: The default folder permissions.
  • access: public
integer getFolderPermissions ()
getOption (line 91)

Get an option from supplied options, the cacheManager options, or xpdo itself.

  • return: The value of the option.
  • access: public
mixed getOption (string $key, [array $options = array()], [mixed $default = null])
  • string $key: Unique identifier for the option.
  • array $options: A set of explicit options to override those from xPDO or the xPDOCacheManager implementation.
  • mixed $default: An optional default value to return if no value is found.
matches (line 471)

Sees if a string matches a specific pattern or set of patterns.

  • return: True if the string matched the pattern or any of the patterns provided.
  • access: public
boolean matches (string $string, string|array $pattern)
  • string $string: The string to check.
  • string|array $pattern: The pattern or an array of patterns to check against.
replace (line 567)

Replace a key-value pair in in a cache provider.

  • return: True if the replace was successful.
  • access: public
boolean replace (string $key, mixed &$var, [integer $lifetime = 0], [array $options = array()])
  • string $key: A unique key identifying the item being replaced.
  • integer $lifetime: Seconds the item will be valid in objcache.
  • array $options: Additional options for the cache replace operation.
  • mixed &$var: & $var A reference to the PHP variable representing the item.
set (line 591)

Set a key-value pair in a cache provider.

  • return: True if the set was successful
  • access: public
boolean set (string $key, mixed &$var, [integer $lifetime = 0], [array $options = array()])
  • string $key: A unique key identifying the item being set.
  • integer $lifetime: Seconds the item will be valid in objcache.
  • array $options: Additional options for the cache set operation.
  • mixed &$var: & $var A reference to the PHP variable representing the item.
writeFile (line 201)

Writes a file to the filesystem

  • return: Returns true if the file was successfully written.
  • access: public
boolean writeFile (string $filename, string $content, [string $mode = 'wb'], [array $options = array()])
  • string $filename: The absolute path to the location the file will be written in.
  • string $content: The content of the newly written file.
  • string $mode: The php file mode to write in. Defaults to 'wb'
  • array $options: An array of options for the function.
writeTree (line 226)

Recursively writes a directory tree of files to the filesystem

  • return: Returns true if the directory was successfully written.
  • access: public
boolean writeTree (string $dirname, [array $options = array()])
  • string $dirname: The directory to write
  • array $options: An array of options for the function. Can also be a value representing a permissions mode to write new directories with, though this is deprecated.
Class Constants
CACHE_DIR = 'objects/' (line 37)
CACHE_JSON = 1 (line 36)
CACHE_PHP = 0 (line 35)
LOG_DIR = 'logs/' (line 38)

Documentation generated on Mon, 27 Dec 2010 11:08:27 -0700 by phpDocumentor 1.4.3