1. Go to this page and download the library: Download mbretter/stk-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/ */
mbretter / stk-cache example snippets
$memcached = new Memcached();
$memcached->addServer("127.0.0.1", 11211, 50]);
$pool = new Cache\Pool\Memcached($memcached);
$cache = new Cache\Cache($pool);
$pool = new Cache\Pool\APCu();
$cache = new Cache\Cache($pool);
$pool = new Cache\Pool\Blackhole();
$cache = new Cache\Cache($pool);
$pool = new Cache\Pool\Memory();
$cache = new Cache\Cache($pool);
$pool = new Cache\Pool\APCu();
$cache = new Cache\Cache($pool);
$val = $cache->getSet('mykey', function() {
// ... do some expensive calculations
return $val;
});