ThinkCache

安装ThinkCache

composer require psr/container ^1.1.1 webman/think-cache

webman/think-cache 实际上是一个自动化安装toptink/think-cache 的插件。

配置文件

配置文件为 config/thinkcache.php

使用

  1. <?php
  2. namespace app\controller;
  3. use support\Request;
  4. use think\facade\Cache;
  5. class User
  6. {
  7. public function db(Request $request)
  8. {
  9. $key = 'test_key';
  10. Cache::set($key, rand());
  11. return response(Cache::get($key));
  12. }
  13. }

Think-Cache使用文档

ThinkCache文档地址