Actions

API15

JCacheStorageFile/gc

From Joomla! Documentation

< API15:JCacheStorageFile
Revision as of 17:12, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
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

[Edit Descripton]

Description:JCacheStorageFile/gc

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;
}

[Edit See Also] SeeAlso:JCacheStorageFile/gc

Examples

<CodeExamplesForm />