Cache class that stores content in files.
Method Summary
-
boolean
clean()
Cleans the cache.
-
boolean
cleanDir(, , )
Recursive function for cleaning cache file in the given directory.
-
string
get(, , )
Tests if a cache is available and (if yes) returns it.
-
getCacheDir()
-
boolean
getFileLocking()
Gets the value of the fileLocking option.
-
array
getFileName(, )
Makes a file name (with path).
-
boolean
getWriteControl()
Gets the value of the writeControl option.
-
boolean
has(, , )
Returns true if there is a cache for the given id and namespace.
-
string
hash($data)
Makes a control key with the string containing datas.
-
initialize()
Initializes the cache.
-
int
lastModified()
Returns the cache last modification time.
-
string
read(, )
Reads the cache file and returns the content.
-
boolean
remove(, )
Removes a cache file.
-
boolean
set(, , )
Saves some data in a cache file.
-
setCacheDir()
Sets the cache root directory.
-
setFileLocking()
Enables / disables file locking.
-
setSuffix()
Sets the suffix for cache files.
-
setWriteControl()
Enables / disables write control.
-
boolean
unlink()
Removes a file.
-
boolean
write(, , )
Writes the given data in the cache file.
-
boolean
writeAndControl(, , )
Writes the given data in the cache file and controls it just after to avoid corrupted cache entries.
-
__construct()
Constructor.
Methods inherited from sfCache
clean , get , getLifeTime , has , lastModified , remove , set , setLifeTime
Method Details
-
Cleans the cache.
If no namespace is specified all cache files will be destroyed
else only cache files of the specified namespace will be destroyed.
returns true if no problem
-
(boolean) cleanDir (, , )
Browse code
Recursive function for cleaning cache file in the given directory.
returns true if no problem
throws sfCacheException
-
Tests if a cache is available and (if yes) returns it.
returns Data of the cache (or null if no cache available)
-
-
(boolean) getFileLocking ()
Browse code
Gets the value of the fileLocking option.
-
(array) getFileName (, )
Browse code
Makes a file name (with path).
returns An array containing the path and the file name
-
(boolean) getWriteControl ()
Browse code
Gets the value of the writeControl option.
-
Returns true if there is a cache for the given id and namespace.
returns true if the cache exists, false otherwise
-
Makes a control key with the string containing datas.
returns control key
-
Initializes the cache.
-
Returns the cache last modification time.
returns The last modification time
-
Reads the cache file and returns the content.
returns The content of the cache file.
throws sfCacheException
-
Removes a cache file.
returns true if no problem
-
Saves some data in a cache file.
returns true if no problem
-
Sets the cache root directory.
-
Enables / disables file locking.
-
Sets the suffix for cache files.
-
Enables / disables write control.
-
Removes a file.
returns true if no problem
-
(boolean) write (, , )
Browse code
Writes the given data in the cache file.
returns true if ok
throws sfCacheException
-
(boolean) writeAndControl (, , )
Browse code
Writes the given data in the cache file and controls it just after to avoid corrupted cache entries.
returns true if the test is ok
-
Constructor.
|