PHP code example of modmore / revolution-cache
1. Go to this page and download the library: Download modmore/revolution-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/ */
modmore / revolution-cache example snippets
` php
ol = new \modmore\RevolutionCache\Pool($modx);
// Do some cache stuff
$item = $pool->getItem('my_value');
if ($item->isHit()) {
echo 'Your number is ' . $item->get() . ' and was loaded from cache.';
}
else {
$value = mt_rand(1, 9999);
$item->set($value);
if ($pool->save($item)) {
echo 'Your number is ' . $value . ' and has been stored in the cache.';
}
else {
echo 'Your number is ' . $value . ' but could not be written to cache';
}
}