cache.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 缓存设置
  13. // +----------------------------------------------------------------------
  14. // return [
  15. // // 驱动方式
  16. // 'type' => 'File',
  17. // // 缓存保存目录
  18. // 'path' => '',
  19. // // 缓存前缀
  20. // 'prefix' => '',
  21. // // 缓存有效期 0表示永久缓存
  22. // 'expire' => 0,
  23. // ];
  24. use think\facade\Env;
  25. return [
  26. 'type' => 'complex',
  27. 'default' => [
  28. 'type' => 'file',
  29. // 全局缓存有效期(0为永久有效)
  30. 'expire'=> 0,
  31. // 缓存前缀
  32. 'prefix'=> 'think',
  33. // 缓存目录
  34. 'path' => '../runtime/cache/',
  35. ],
  36. 'file' => [
  37. 'type' => 'file',
  38. // 全局缓存有效期(0为永久有效)
  39. 'expire'=> 0,
  40. // 缓存前缀
  41. 'prefix'=> 'think',
  42. // 缓存目录
  43. 'path' => '../runtime/cache/',
  44. ],
  45. 'db_config_public' => [
  46. 'type' => Env::get('public_redis.type', 'redis'),
  47. 'host' => Env::get('public_redis.host', '127.0.0.1'),
  48. 'port' => Env::get('public_redis.port', 6379),
  49. 'password' => Env::get('public_redis.password', ''),
  50. // 全局缓存有效期(0为永久有效)
  51. 'expire'=> 0,
  52. 'timeout'=> -1,
  53. // 缓存前缀
  54. 'prefix'=> Env::get('public_redis.prefix', 'think'),
  55. ],
  56. 'db_config_private' => [
  57. 'type' => Env::get('private_redis.type', 'redis'),
  58. 'host' => Env::get('private_redis.host', '127.0.0.1'),
  59. 'port' => Env::get('private_redis.port', 6379),
  60. 'password' => Env::get('private_redis.password', ''),
  61. // 全局缓存有效期(0为永久有效)
  62. 'expire'=> 0,
  63. 'timeout'=> -1,
  64. // 缓存前缀
  65. 'prefix'=> Env::get('private_redis.prefix', 'think'),
  66. ]
  67. ];