ThinkCache
安裝ThinkCache
composer require -W webman/think-cache:~1.0
安裝后需要restart重啟(reload無效)
webman/think-cache 實(shí)際上是一個(gè)自動(dòng)化安裝
toptink/think-cache
的插件。注意
toptink/think-cache 不支持php8.1
配置文件
配置文件為 config/thinkcache.php
使用
<?php
namespace app\controller;
use support\Request;
use think\facade\Cache;
class UserController
{
public function db(Request $request)
{
$key = 'test_key';
Cache::set($key, rand());
return response(Cache::get($key));
}
}