Cache class that stores content in files.
Method Summary
-
clean($mode = sfCache::ALL)
-
get($key, $default = null)
-
string
getFilePath($key)
Converts a cache key to a full path.
-
getLastModified($key)
-
getTimeout($key)
-
has($key)
-
initialize($options = array())
Initializes this sfCache instance.
-
isValid($path)
-
array
read($path, $type = self::READ_DATA)
Reads the cache file and returns the content.
-
remove($key)
-
removePattern($pattern)
-
set($key, $data, $lifetime = null)
-
setcache_dir($cache_dir)
Sets the cache root directory.
-
boolean
write($path, $data, $timeout)
Writes the given data in the cache file.
Methods inherited from sfCache
clean , get , getBackend , getLastModified , getLifetime , getMany , getOption , getTimeout , has , initialize , patternToRegexp , remove , removePattern , set , setOption , __construct
Method Details
-
clean ($mode = sfCache::ALL)
Browse code
-
get ($key, $default = null)
Browse code
-
(string) getFilePath ($key)
Browse code
Converts a cache key to a full path.
returns The full path to the cache file
-
getLastModified ($key)
Browse code
-
-
-
initialize ($options = array())
Browse code
Initializes this sfCache instance.
Available options: * cache_dir: The directory where to put cache files * see sfCache for options available for all drivers
-
-
(array) read ($path, $type = self::READ_DATA)
Browse code
| $path |
The file path
|
| $type |
The type of data you want to be returned
sfFileCache::READ_DATA: The cache content
sfFileCache::READ_TIMEOUT: The timeout
sfFileCache::READ_LAST_MODIFIED: The last modification timestamp
|
Reads the cache file and returns the content.
returns the (meta)data of the cache file. E.g. $data[sfFileCache::READ_DATA]
throws sfCacheException
-
-
removePattern ($pattern)
Browse code
-
set ($key, $data, $lifetime = null)
Browse code
-
setcache_dir ($cache_dir)
Browse code
| $cache_dir |
The directory where to put the cache files
|
Sets the cache root directory.
-
(boolean) write ($path, $data, $timeout)
Browse code
| $path |
The file path
|
| $data |
The data to put in cache
|
| $timeout |
The timeout timestamp
|
Writes the given data in the cache file.
returns true if ok, otherwise false
throws sfCacheException
|