PHP code example of simbiat / htmlcache

1. Go to this page and download the library: Download simbiat/htmlcache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

simbiat / htmlcache example snippets


$usedFiles = get_ count($usedFiles).'.'.max(max(array_map('filemtime', array_filter($usedFiles, 'is_file'))),

#Create HTMLCache object
$HTMLCache = (new \Simbiat\HTMLCache($siteconfig['cachedir'].'html/'));
#Attempt to use cache
$HTMLCache->get('', true, true, true);
#Do some processing in case cache was not hit, to get $output
#Save to cache and output directly
if ($uri[1] === 'statistics') {
    $HTMLCache->set($output, '', 604800, 600, true, true);
} elseif ($uri[1] === 'achievement') {
    $HTMLCache->set($output, '', 259200, 600, true, true);
}
#Output page if not 

__construct(string $filesPool = '', bool $apcu = false, int $maxRandom = 1)

set(string $string, string $key ='', int $ttl = 60, int $grace = 100, bool $zip = true, bool $direct = true, string $cacheStrat = '')

get(string $key = '', bool $scriptVersion = true, bool $direct = true, bool $staleReturn = false)

cacheOutput(array $data, bool $exit = true)

delete(string $key = '')

gc(int $maxAge = 60, int $maxSize = 1024)