]> BookStack Code Mirror - bookstack/blob - app/Config/cache.php
Framework: Upgrade from Laravel 9 to 10
[bookstack] / app / Config / cache.php
1 <?php
2
3 use Illuminate\Support\Str;
4
5 /**
6  * Caching configuration options.
7  *
8  * Changes to these config files are not supported by BookStack and may break upon updates.
9  * Configuration should be altered via the `.env` file or environment variables.
10  * Do not edit this file unless you're happy to maintain any changes yourself.
11  */
12
13 // MEMCACHED - Split out configuration into an array
14 if (env('CACHE_DRIVER') === 'memcached') {
15     $memcachedServerKeys = ['host', 'port', 'weight'];
16     $memcachedServers = explode(',', trim(env('MEMCACHED_SERVERS', '127.0.0.1:11211:100'), ','));
17     foreach ($memcachedServers as $index => $memcachedServer) {
18         $memcachedServerDetails = explode(':', $memcachedServer);
19         if (count($memcachedServerDetails) < 2) {
20             $memcachedServerDetails[] = '11211';
21         }
22         if (count($memcachedServerDetails) < 3) {
23             $memcachedServerDetails[] = '100';
24         }
25         $memcachedServers[$index] = array_combine($memcachedServerKeys, $memcachedServerDetails);
26     }
27 }
28
29 return [
30
31     // Default cache store to use
32     // Can be overridden at cache call-time
33     'default' => env('CACHE_DRIVER', 'file'),
34
35     // Available caches stores
36     'stores' => [
37
38         'apc' => [
39             'driver' => 'apc',
40         ],
41
42         'array' => [
43             'driver'    => 'array',
44             'serialize' => false,
45         ],
46
47         'database' => [
48             'driver'          => 'database',
49             'table'           => 'cache',
50             'connection'      => null,
51             'lock_connection' => null,
52         ],
53
54         'file' => [
55             'driver' => 'file',
56             'path'   => storage_path('framework/cache/data'),
57             'lock_path' => storage_path('framework/cache/data'),
58         ],
59
60         'memcached' => [
61             'driver'        => 'memcached',
62             'options'       => [
63                 // Memcached::OPT_CONNECT_TIMEOUT => 2000,
64             ],
65             'servers' => $memcachedServers ?? [],
66         ],
67
68         'redis' => [
69             'driver'          => 'redis',
70             'connection'      => 'default',
71             'lock_connection' => 'default',
72         ],
73
74         'octane' => [
75             'driver' => 'octane',
76         ],
77
78     ],
79
80     /*
81     |--------------------------------------------------------------------------
82     | Cache Key Prefix
83     |--------------------------------------------------------------------------
84     |
85     | When utilizing a RAM based store such as APC or Memcached, there might
86     | be other applications utilizing the same cache. So, we'll specify a
87     | value to get prefixed to all our keys so we can avoid collisions.
88     |
89     */
90
91     'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'),
92
93 ];