Simple, effient cache class for PHP.
简单、高效的 PHP 缓存类
composer require mantoufan/yzhancache
$yzhanCache = new YZhanCache('File'); // Default: File Engine
$yzhanCache = new YZhanCache('File', array(
'dir' => sys_get_temp_dir() . '/yzhancache' // Default Cache Dir
));
$yzhanCache->set($key, $val, $maxAge = null); // Unit of $maxAge is seconds
$yzhanCache->set('1', 'a', 1)->set('2', array(1, 2, 3)) // Chain call
$yzhanCache->get($key);
$yzhanCache->get('1'); // a
$yzhanCache->get('2'); // [1, 2, 3]
$yzhanCache->get('1'); // null, expires over $maxAge
$yzhanCache->has($key); // true / false
$yzhanCache->delete($key);
$yzhanCache->set('1', 'a')->delete('1'); // Chain call
$yzhanCache->clear();
$yzhanCache->clear()->set('1', 'a')->delete('1'); // Chain call