1. Go to this page and download the library: Download xnicon/simple-php-cache 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/ */
xnicon / simple-php-cache example snippets
use \phpCache\Cache;
$c = new Cache();
if(!$c->has("example")) {
$c->set("example", 'cache data', 300); // cache result for 5 minutes (300 seconds)
} else {
echo $c->get("example");
}
$example = $c->get("example");
if($example !== false) {
echo "Cached: " . $example;
$c->remove("example"); // remove from cache
} else {
echo "Cache not found or expired";
}