Actions

API15

JCacheStorageFile/gc

< API15:JCacheStorageFile

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

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

Code Examples


Advertisement