think-cache插件

v1.0.2 版本
2023-01-12 版本更新时间
8827 安装
4 star

简介

think-cache是ThinkPHP官方的一个PHP缓存组件。

webman/think-cache 是一个自动化安装卸载 topthink/think-cache 的插件。它不是对topthink/think-cache的二次封装,它只是一个自动化安装脚本,用于自动安装topthink/think-cache并自动配置webman的插件。

注意
topthink/think-cache 不支持php8.1,不支持tag标签

安装

composer require -W webman/think-cache

安装后将自动生成 config/thinkcache.php 配置文件。

使用

<?php
namespace app\controller;

use support\Request;
use think\facade\Cache;

class User
{
  public function db(Request $request)
  {
      $key = 'test_key';
      Cache::set($key, rand());
      return response(Cache::get($key));
  }
}

更多信息

更多信息参考 think-cache 文档