1. Go to this page and download the library: Download cheese44/cheesecache 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/ */
cheese44 / cheesecache example snippets
use cheeseCache\app;
class Test {
/**
* cheeseCache does all the work for you
*
* you don't have to clutter your code with checking, setting and reading the cache yourself
*/
public function cacheSum($a, $b) {
$cache = cheeseCache\app\cacheProvider::getCache();
$sum = $cache->cache(
array($a, $b),
function() use($a, $b) {
return $a + $b;
});
return $sum;
}
/**
* of course cheeseCache still gives you the possibility to manually access these functionalities
*/
public function cacheSum_Explicit($a, $b) {
$cache = cheeseCache\app\cacheProvider::getCache();
if($cache->isCacheSet(array($a, $b))):
return $cache->geCacheValue(array($a, $b));
endif;
$sum = $a + $b;
$cache->cache(
array($a, $b),
$sum
);
return $sum;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.