]> BookStack Code Mirror - bookstack/blob - app/Config/cache.php
Lexical: Fixed code in lists, removed extra old alignment code
[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         'array' => [
39             'driver'    => 'array',
40             'serialize' => false,
41         ],
42
43         'database' => [
44             'driver'          => 'database',
45             'table'           => 'cache',
46             'connection'      => null,
47             'lock_connection' => null,
48             'lock_table'      => null,
49         ],
50
51         'file' => [
52             'driver' => 'file',
53             'path'   => storage_path('framework/cache'),
54             'lock_path' => storage_path('framework/cache'),
55         ],
56
57         'memcached' => [
58             'driver'        => 'memcached',
59             'options'       => [
60                 // Memcached::OPT_CONNECT_TIMEOUT => 2000,
61             ],
62             'servers' => $memcachedServers ?? [],
63         ],
64
65         'redis' => [
66             'driver'          => 'redis',
67             'connection'      => 'default',
68             'lock_connection' => 'default',
69         ],
70
71         'octane' => [
72             'driver' => 'octane',
73         ],
74
75     ],
76
77     /*
78     |--------------------------------------------------------------------------
79     | Cache Key Prefix
80     |--------------------------------------------------------------------------
81     |
82     | When utilizing a RAM based store such as APC or Memcached, there might
83     | be other applications utilizing the same cache. So, we'll specify a
84     | value to get prefixed to all our keys so we can avoid collisions.
85     |
86     */
87
88     'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'),
89
90 ];