cache.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. use Illuminate\Support\Str;
  3. return [
  4. 'expirations'=>[
  5. 'default'=>10, //默认
  6. 'oftenChange'=>5, //经常改
  7. 'rarelyChange'=>60, //几乎不变
  8. 'commonFrequent'=>20, //一般频率
  9. 'forever' =>null, //永久
  10. 'owners'=>20, //模型Owner
  11. ],
  12. /*
  13. |--------------------------------------------------------------------------
  14. | Default Cache Store
  15. |--------------------------------------------------------------------------
  16. |
  17. | This option controls the default cache connection that gets used while
  18. | using this caching library. This connection is used when another is
  19. | not explicitly specified when executing a given caching function.
  20. |
  21. | Supported: "apc", "array", "database", "file",
  22. | "memcached", "redis", "dynamodb"
  23. |
  24. */
  25. 'default' => env('CACHE_DRIVER', 'file'),
  26. /*
  27. |--------------------------------------------------------------------------
  28. | Cache Stores
  29. |--------------------------------------------------------------------------
  30. |
  31. | Here you may define all of the cache "stores" for your application as
  32. | well as their drivers. You may even define multiple stores for the
  33. | same cache driver to group types of items stored in your caches.
  34. |
  35. */
  36. 'stores' => [
  37. 'apc' => [
  38. 'driver' => 'apc',
  39. ],
  40. 'array' => [
  41. 'driver' => 'array',
  42. ],
  43. 'database' => [
  44. 'driver' => 'database',
  45. 'table' => 'cache',
  46. 'connection' => null,
  47. ],
  48. 'file' => [
  49. 'driver' => 'file',
  50. 'path' => storage_path('framework/cache/data'),
  51. ],
  52. 'memcached' => [
  53. 'driver' => 'memcached',
  54. 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
  55. 'sasl' => [
  56. env('MEMCACHED_USERNAME'),
  57. env('MEMCACHED_PASSWORD'),
  58. ],
  59. 'options' => [
  60. // Memcached::OPT_CONNECT_TIMEOUT => 2000,
  61. ],
  62. 'servers' => [
  63. [
  64. 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
  65. 'port' => env('MEMCACHED_PORT', 11211),
  66. 'weight' => 100,
  67. ],
  68. ],
  69. ],
  70. 'redis' => [
  71. 'driver' => 'redis',
  72. 'connection' => 'cache',
  73. ],
  74. 'dynamodb' => [
  75. 'driver' => 'dynamodb',
  76. 'key' => env('AWS_ACCESS_KEY_ID'),
  77. 'secret' => env('AWS_SECRET_ACCESS_KEY'),
  78. 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
  79. 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
  80. 'endpoint' => env('DYNAMODB_ENDPOINT'),
  81. ],
  82. ],
  83. /*
  84. |--------------------------------------------------------------------------
  85. | Cache Key Prefix
  86. |--------------------------------------------------------------------------
  87. |
  88. | When utilizing a RAM based store such as APC or Memcached, there might
  89. | be other applications utilizing the same cache. So, we'll specify a
  90. | value to get prefixed to all our keys so we can avoid collisions.
  91. |
  92. */
  93. 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
  94. ];