Add a key-value pair to a cache provider if it does not already exist.
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.
xPDOCacheManager
__construct
( &$xpdo, [ $options = array()])
Flush the contents of a cache provider.
boolean
clean
([array $options = array()])
-
array
$options: Additional options for the cache flush.
Copies a file from a source file to a target directory.
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.
Recursively copies a directory tree from a source directory to a target directory.
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 a key-value pair from a cache provider.
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.
Recursively deletes a directory tree of files.
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.
Sees if a string ends with a specific pattern or set of patterns.
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.
Escapes all single quotes in a string
string
escapeSingleQuotes
(string $s)
-
string
$s: The string to escape single quotes in.
Generate a PHP executable representation of an xPDOObject.
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 a value from a cache provider by key.
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.
Get the absolute path to a writable directory for storing files.
string
getCachePath
()
Get an instance of a provider which implements the xPDOCache interface.
void
&getCacheProvider
([ $key = ''], [ $options = array()])
Get default file permissions based on umask
integer
getFilePermissions
()
Get default folder permissions based on umask
integer
getFolderPermissions
()
Get an option from supplied options, the cacheManager options, or xpdo itself.
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.
Sees if a string matches a specific pattern or set of patterns.
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 a key-value pair in in a cache provider.
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 a key-value pair in a cache provider.
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.
Writes a file to the filesystem
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.
Recursively writes a directory tree of files to the filesystem
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.