cache.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 缓存设置
  4. // +----------------------------------------------------------------------
  5. return [
  6. // 默认缓存驱动
  7. 'default' => env('cache.driver', 'file'),
  8. // 缓存连接方式配置
  9. 'stores' => [
  10. 'file' => [
  11. // 驱动方式
  12. 'type' => 'File',
  13. // 缓存保存目录
  14. 'path' => app()->getRuntimePath() . 'cache' . DIRECTORY_SEPARATOR,
  15. // 缓存前缀
  16. 'prefix' => '',
  17. // 缓存有效期 0表示永久缓存
  18. 'expire' => 0,
  19. // 缓存标签前缀
  20. 'tag_prefix' => 'tag:',
  21. // 序列化机制 例如 ['serialize', 'unserialize']
  22. 'serialize' => [],
  23. ],
  24. // 更多的缓存连接
  25. // redis
  26. 'redis' => [
  27. // 驱动方式
  28. 'type' => 'redis',
  29. // 服务器地址
  30. 'host' => env('redis.redis_hostname', '127.0.0.1'),
  31. // 端口
  32. 'port' => env('redis.port', '6379'),
  33. // 密码
  34. 'password' => env('redis.redis_password', ''),
  35. // 缓存有效期 0表示永久缓存
  36. 'expire' => 0 ,
  37. // 缓存前缀
  38. 'prefix' => '',
  39. // 缓存标签前缀
  40. 'tag_prefix' => 'tag:',
  41. // 数据库 0号数据库
  42. 'select' => env('redis.select', 0),
  43. 'serialize' => [],
  44. // 服务端主动关闭
  45. 'timeout' => 0
  46. ],
  47. ],
  48. ];