Documentation

IsCacheExpired

bool
CPHPCache::IsCacheExpired(
 string path
)

The method checks whether the cache is expired or not. Usually, the function is used to delete the expired cache files. Non-static method.

Note. Cache file created by the CPHPCache class functions has the ".php" extention.

Parameters

ParameterDescription
path The full path to the cache file.

See Also

  • CPHPCache::InitCache
  • BXClearCache
  • Examples of use

    <?
    $path = $_SERVER["DOCUMENT_ROOT"]."/bitrix/cache/";
    if($handle = @opendir($path))
    {
        while(($file=readdir($handle))!==false)
        {
            if($file == "." || $file == "..") continue;
            if(!is_dir($path."/".$file))
            {
                if(substr($file, -5)==".html")
                    $expired = CPageCache::IsCacheExpired($path."/".$file);
                elseif(substr($file, -4)==".php")
                    $expired = CPHPCache::IsCacheExpired($path."/".$file);
            }
        }
    }
    ?>


    © «Bitrix24», 2001-2022
    Up