PHP code example of wenhainan / filecache
1. Go to this page and download the library: Download wenhainan/filecache 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/ */
wenhainan / filecache example snippets
use wenhainan\filecache;
//config. it has a default config.
$cache = new filecache();
//设置缓存 set key cache
$cache->set('key','value',60); //set key = value expire = 60s
//获取缓存 get key cache
$cache->get('key');
//删除缓存 delete cache
$cache->del('key');
//自定义缓存配置
$config = [
'expire'=>3600, //expire time , unit seconds 默认缓存时间,单位秒
'path' =>'/tmp' //self dir
];
$cache = new filecache($config);