Exemple #1
0
<?php

/*
 * Bootstrap cache
 */
use WebSupportDK\PHPFilesystem\Cache;
if ($app->get('mode')->cache) {
    $cache = new Cache();
    $cache->setDir(APP_CACHE_DIR);
    $cache->setTime($app->get('config')->cache->time);
    $cache->setExt($app->get('config')->cache->ext);
    $cache->setIgnore($app->get('config')->cache->ignore);
}
<?php

require_once '../src/Cache.php';
use WebSupportDK\PHPFilesystem\Cache;
$cache = new Cache();
$cache->setDir('cache/');
$cache->setTime(1800);
$cache->setExt('html');
// get a query string
$page = $_GET['page'];
// set it is the current page
$cache->setUrl($page);
// start the cache
$cache->start();
echo "The current page is {$page}";
// stop the cache
$cache->stop();
// to delete all cache files
//$cache->clear();