JCacheStorageFile/gc
From Joomla! Documentation
< API15:JCacheStorageFileRevision as of 17:12, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description===
Garbage collect expired cache data
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]<...)
Revision as of 17:12, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description===
Garbage collect expired cache data
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]<...)
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Garbage collect expired cache data
Template:Description:JCacheStorageFile/gc
Syntax[edit]
gc()
Returns[edit]
boolean True on success, false otherwise.
Defined in[edit]
libraries/joomla/cache/storage/file.php
Importing[edit]
jimport( 'joomla.cache.storage.file' );
Source Body[edit]
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;
}
[Edit See Also] Template:SeeAlso:JCacheStorageFile/gc
Examples[edit]
<CodeExamplesForm />