//引入
use think\Cache;
//使用
$options = [
// 緩存類型爲File
'type' => 'File',
// 緩存有效期爲永久有效
'expire' => 0,
//緩存前綴
'prefix' => 'think',
// 指定緩存目錄
'path' => APP_PATH . 'runtime/cache/',
];
Cache::connect($options);
if (!Cache::has($this->lightId)) {
Cache::set($this->lightId, $this->lightId, 15);//設置緩存時間15秒
return $return;
} else {
return getjson('0', '存在', '');
}
//刪除
$options = [
// 緩存類型爲File
'type' => 'File',
// 緩存有效期爲永久有效
'expire' => 0,
//緩存前綴
'prefix' => 'think',
// 指定緩存目錄
'path' => APP_PATH . 'runtime/cache/',
];
Cache::connect($options);
Cache::rm($goodordern['lightId']);//刪除緩存可進行下一個動作
QQ:961052877