cache.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. use Illuminate\Support\Str;
  11. return [
  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", "memcached", "redis"
  22. |
  23. */
  24. 'default' => env('CACHE_DRIVER', 'file'),
  25. /*
  26. |--------------------------------------------------------------------------
  27. | Cache Stores
  28. |--------------------------------------------------------------------------
  29. |
  30. | Here you may define all of the cache "stores" for your application as
  31. | well as their drivers. You may even define multiple stores for the
  32. | same cache driver to group types of items stored in your caches.
  33. |
  34. */
  35. 'stores' => [
  36. 'apc' => [
  37. 'driver' => 'apc',
  38. ],
  39. 'array' => [
  40. 'driver' => 'array',
  41. ],
  42. 'database' => [
  43. 'driver' => 'database',
  44. 'table' => env('CACHE_DATABASE_TABLE', 'cache'),
  45. 'connection' => env('CACHE_DATABASE_CONNECTION', null),
  46. ],
  47. 'file' => [
  48. 'driver' => 'file',
  49. 'path' => storage_path('framework/cache/data'),
  50. ],
  51. 'memcached' => [
  52. 'driver' => 'memcached',
  53. 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
  54. 'sasl' => [
  55. env('MEMCACHED_USERNAME'),
  56. env('MEMCACHED_PASSWORD'),
  57. ],
  58. 'options' => [
  59. // Memcached::OPT_CONNECT_TIMEOUT => 2000,
  60. ],
  61. 'servers' => [
  62. [
  63. 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
  64. 'port' => env('MEMCACHED_PORT', 11211),
  65. 'weight' => 100,
  66. ],
  67. ],
  68. ],
  69. 'redis' => [
  70. 'driver' => 'redis',
  71. 'connection' => env('CACHE_REDIS_CONNECTION', 'default'),
  72. ],
  73. ],
  74. /*
  75. |--------------------------------------------------------------------------
  76. | Cache Key Prefix
  77. |--------------------------------------------------------------------------
  78. |
  79. | When utilizing a RAM based store such as APC or Memcached, there might
  80. | be other applications utilizing the same cache. So, we'll specify a
  81. | value to get prefixed to all our keys so we can avoid collisions.
  82. |
  83. */
  84. 'prefix' => env(
  85. 'CACHE_PREFIX',
  86. Str::slug(env('APP_NAME', 'lumen'), '_') . '_cache'
  87. ),
  88. ];