Class Cache
Handles writing to and from the cache
Final
Package: minPHP\
lib
Located at lib/cache.php
Methods summary
final public static
|
#
emptyCache( string $path = null )
Empties the entire cache of all files (directories excluded, not
recursive)
Empties the entire cache of all files (directories excluded, not
recursive)
Parameters
- $path
string $path The path within CACHEDIR to empty
|
final public static
boolean
|
#
clearCache( string $name, string $path = null )
Removes the given cache file from the cache
Removes the given cache file from the cache
Parameters
- $name
string $name The name of the cache file to remove (note: the original file name, not
the cached name of the file)
- $path
string $path The patch within CACHEDIR to clear a given file from
Returns
boolean True if removed, false if no such file exists
See
|
final public static
|
#
writeCache( string $name, string $output, integer $ttl, string $path = null )
Writes the given data to the cache using the name given
Writes the given data to the cache using the name given
Parameters
- $name
string $name The name of the cache file to create (note: the original file name, not
the cached name of the file)
- $output
string $output The data to write to the cache
- $ttl
integer $ttl The cache file's time to live
- $path
string $path The path within CACHEDIR to write the file to
See
|
final public static
string
|
#
fetchCache( string $name, string $path = null )
Fetches the contents of a cache, if it exists and is valid
Fetches the contents of a cache, if it exists and is valid
Parameters
- $name
string $name The name of the cache file to fetch (note: not the actual name of the file
on the file system)
- $path
string $path The path within CACHEDIR to read the file from
Returns
string A string containing the file contents if the cache file exists and has not yet
expired, false otherwise.
See
|
final private static
string
|
#
cacheName( string $name, string $path = null )
Builds the file name of the cache file based on the name given
Builds the file name of the cache file based on the name given
Parameters
- $name
string $name The name to use when creating the cache file name
- $path
string $path The path within CACHEDIR to construct the cache file path in
Returns
string A fully qualified cache file name
|
Magic methods summary