cache.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use think\facade\Env;
  3. // +----------------------------------------------------------------------
  4. // | 缓存设置
  5. // +----------------------------------------------------------------------
  6. return [
  7. // 默认缓存驱动
  8. 'default' => 'redis',
  9. // 缓存连接方式配置
  10. 'stores' => [
  11. 'file' => [
  12. // 驱动方式
  13. 'type' => 'File',
  14. // 缓存保存目录
  15. 'path' => '',
  16. // 缓存前缀
  17. 'prefix' => '',
  18. // 缓存有效期 0表示永久缓存
  19. 'expire' => 0,
  20. // 缓存标签前缀
  21. 'tag_prefix' => 'tag:',
  22. // 序列化机制 例如 ['serialize', 'unserialize']
  23. 'serialize' => [],
  24. ],
  25. // 更多的缓存连接
  26. // redis缓存
  27. 'redis' => [
  28. // 驱动方式
  29. 'type' => 'redis',
  30. // 服务器地址
  31. 'expire'=> 30*24*3600,
  32. 'host' => env('cache.host','47.112.222.163'),
  33. 'password' => env('cache.password','derkj&6688'),
  34. 'port'=> env('cache.port','6379'),
  35. 'select'=> env('cache.select',0),
  36. 'timeout'=> env('cache.timeout',7200),
  37. ],
  38. ],
  39. ];