1. Go to this page and download the library: Download yabx/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/ */
yabx / cache example snippets
use Yabx\Cache\FileCache;
use Yabx\Cache\RedisCache;
// FileCache
$cache = new FileCache(__DIR__ . '/cache');
// or RedisCache
$redis = new Redis;
$redis->connect('localhost');
$cache = new RedisCache($redis, 'prefix:');
// Setting value (3600 seconds live period)
$cache->set('key', $value, 3600);
// Getting value by key
$value = $cache->get('key');
// Deleting value by key
$cache->delete('key');
// ....
$key = 'calculated';
// Checking for cached item with $key
if(!$value = $cache->get($key)) {
// Hardworking for calculate value
$value = calc(....);
$cache->set($key, $value, 3600);
}
// Displing value
echo $value;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.