FileStorage
Extends CacheStorageFile cache storage handler
since |
1.7.0 |
---|---|
note |
For performance reasons this class does not use the Filesystem package's API |
package |
Joomla CMS |
Methods
__construct
Constructor
__construct(array options = array()) : mixed
since |
1.7.0 |
---|
Arguments
- options
array
Optional parameters
Response
mixed
_checkExpire
Check if a cache object has expired
_checkExpire(string id, string group) : bool
Using @ error suppressor here because between if we did a file_exists() and then filemsize() there will be a little time space when another process can delete the file and then you get PHP Warning
since |
1.7.0 |
---|
Arguments
- id
string
Cache ID to check- group
string
The cache data group
Response
bool
True if the cache ID is valid
_cleanPath
Function to strip additional / or \ in a path name
_cleanPath(string path, string ds = DIRECTORY_SEPARATOR) : string
since |
1.7.0 |
---|
Arguments
- path
string
The path to clean- ds
string
Directory separator (optional)
Response
string
The cleaned path
_deleteFolder
Quickly delete a folder of files
_deleteFolder(string path) : bool
since |
1.7.0 |
---|
Arguments
- path
string
The path to the folder to delete.
Response
bool
_filesInFolder
Utility function to quickly read the files in a folder.
_filesInFolder(string path, string filter = '.', mixed recurse = false, bool fullpath = false, array exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array excludefilter = array('^\..*', '.*~')) : array
since |
1.7.0 |
---|
Arguments
- path
string
The path of the folder to read.- filter
string
A filter for file names.- recurse
mixed
True to recursively search into sub-folders, or an integer to specify the maximum depth.- fullpath
bool
True to return the full path to the file.- exclude
array
Array with names of files which should not be shown in the result.- excludefilter
array
Array of folder names to exclude
Response
array
Files in the given folder.
_folders
Utility function to read the folders in a folder.
_folders(string path, string filter = '.', mixed recurse = false, bool fullpath = false, array exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array excludefilter = array('^\..*')) : array
since |
1.7.0 |
---|
Arguments
- path
string
The path of the folder to read.- filter
string
A filter for folder names.- recurse
mixed
True to recursively search into sub-folders, or an integer to specify the maximum depth.- fullpath
bool
True to return the full path to the folders.- exclude
array
Array with names of folders which should not be shown in the result.- excludefilter
array
Array with regular expressions matching folders which should not be shown in the result.
Response
array
Folders in the given folder.
_getCacheId
Get a cache ID string from an ID/group pair
_getCacheId(string id, string group) : string
since |
1.7.0 |
---|
Arguments
- id
string
The cache data ID- group
string
The cache data group
Response
string
_getFilePath
Get a cache file path from an ID/group pair
_getFilePath(string id, string group) : bool|string
since |
1.7.0 |
---|
Arguments
- id
string
The cache data ID- group
string
The cache data group
Response
bool|string
The path to the data object or boolean false if the cache directory does not exist
addIncludePath
Add a directory where CacheStorage should search for handlers. You may either pass a string or an array of directories.
addIncludePath(array|string path = '') : array
since |
1.7.0 |
---|
Arguments
- path
array|string
A path to search.
Response
array
An array with directory elements
clean
Clean cache for a group given a mode.
clean(string group, string mode = null) : bool
group mode : cleans all cache in the group notgroup mode : cleans all cache not in the group
since |
1.7.0 |
---|
Arguments
- group
string
The cache data group- mode
string
The mode for cleaning cache [group|notgroup]
Response
bool
contains
Check if the cache contains data stored by ID and group
contains(string id, string group) : bool
since |
3.7.0 |
---|
Arguments
- id
string
The cache data ID- group
string
The cache data group
Response
bool
flush
Flush all existing items in storage.
flush() : bool
since |
3.6.3 |
---|
Response
bool
gc
Garbage collect expired cache data
gc() : bool
since |
1.7.0 |
---|
Response
bool
get
Get cached data by ID and group
get(string id, string group, bool checkTime = true) : mixed
since |
1.7.0 |
---|
Arguments
- id
string
The cache data ID- group
string
The cache data group- checkTime
bool
True to verify cache time expiration threshold
Response
mixed
Boolean false on failure or a cached data object
getAll
Get all cached data
getAll() : mixed
since |
1.7.0 |
---|
Response
mixed
Boolean false on failure or a cached data object
getInstance
Returns a cache storage handler object.
getInstance(string handler = null, array options = array()) : \Joomla\CMS\Cache\CacheStorage
since |
1.7.0 |
---|---|
throws |
|
Arguments
- handler
string
The cache storage handler to instantiate- options
array
Array of handler options
Response
\Joomla\CMS\Cache\CacheStorage
isSupported
Test to see if the storage handler is available.
isSupported() : bool
since |
3.0.0 |
---|
Response
bool
lock
Lock cached item
lock(string id, string group, int locktime) : mixed
since |
1.7.0 |
---|
Arguments
- id
string
The cache data ID- group
string
The cache data group- locktime
int
Cached item max lock time
Response
mixed
Boolean false if locking failed or an object containing properties lock and locklooped
remove
Remove a cached data entry by ID and group
remove(string id, string group) : bool
since |
1.7.0 |
---|
Arguments
- id
string
The cache data ID- group
string
The cache data group
Response
bool
store
Store the data to cache by ID and group
store(string id, string group, string data) : bool
since |
1.7.0 |
---|
Arguments
- id
string
The cache data ID- group
string
The cache data group- data
string
The data to store in cache
Response
bool
unlock
Unlock cached item
unlock(string id, string group = null) : bool
since |
1.7.0 |
---|
Arguments
- id
string
The cache data ID- group
string
The cache data group
Response
bool