API15:JCacheStorageFile/gc
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Garbage collect expired cache data
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
gc()
Returns
boolean True on success, false otherwise.
Defined in
libraries/joomla/cache/storage/file.php
Importing
jimport( 'joomla.cache.storage.file' );
Source Body
function gc() { jimport('joomla.filesystem.file'); $result = true; // files older than lifeTime get deleted from cache $files = JFolder::files($this->_root, '_expire', true, true); foreach($files As $file) { $time = @file_get_contents($file); if ($time < $this->_now) { $result |= JFile::delete($file); $result |= JFile::delete(str_replace('_expire', '', $file)); } } return $result; }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
