mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Made memcached config allow mulitple servers
This commit is contained in:
parent
069431db72
commit
479dd80a8c
13
.env.example
13
.env.example
@ -17,6 +17,12 @@ SESSION_DRIVER=file
|
|||||||
#SESSION_DRIVER=memcached
|
#SESSION_DRIVER=memcached
|
||||||
QUEUE_DRIVER=sync
|
QUEUE_DRIVER=sync
|
||||||
|
|
||||||
|
# Memcached settings
|
||||||
|
# If using a UNIX socket path for the host, set the port to 0
|
||||||
|
# This follows the following format: HOST:PORT:WEIGHT
|
||||||
|
# For multiple servers separate with a comma
|
||||||
|
MEMCACHED_SERVERS=127.0.0.1:11211:100
|
||||||
|
|
||||||
# Storage
|
# Storage
|
||||||
STORAGE_TYPE=local
|
STORAGE_TYPE=local
|
||||||
# Amazon S3 Config
|
# Amazon S3 Config
|
||||||
@ -56,9 +62,4 @@ MAIL_HOST=localhost
|
|||||||
MAIL_PORT=1025
|
MAIL_PORT=1025
|
||||||
MAIL_USERNAME=null
|
MAIL_USERNAME=null
|
||||||
MAIL_PASSWORD=null
|
MAIL_PASSWORD=null
|
||||||
MAIL_ENCRYPTION=null
|
MAIL_ENCRYPTION=null
|
||||||
|
|
||||||
# Memcached settings
|
|
||||||
#MEMCACHED_HOST=127.0.0.1
|
|
||||||
# If using a UNIX socket path for the host, set the port to 0
|
|
||||||
#MEMCACHED_PORT=11211
|
|
@ -1,5 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// MEMCACHED - Split out configuration into an array
|
||||||
|
if (env('CACHE_DRIVER') === 'memcached') {
|
||||||
|
$memcachedServerKeys = ['host', 'port', 'weight'];
|
||||||
|
$memcachedServers = explode(',', trim(env('MEMCACHED_SERVERS', '127.0.0.1:11211:100'), ','));
|
||||||
|
foreach ($memcachedServers as $index => $memcachedServer) {
|
||||||
|
$memcachedServerDetails = explode(':', $memcachedServer);
|
||||||
|
$components = count($memcachedServerDetails);
|
||||||
|
if ($components < 2) $memcachedServerDetails[] = '11211';
|
||||||
|
if ($components < 3) $memcachedServerDetails[] = '100';
|
||||||
|
$memcachedServers[$index] = array_combine($memcachedServerKeys, $memcachedServerDetails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -49,13 +62,7 @@ return [
|
|||||||
|
|
||||||
'memcached' => [
|
'memcached' => [
|
||||||
'driver' => 'memcached',
|
'driver' => 'memcached',
|
||||||
'servers' => [
|
'servers' => env('CACHE_DRIVER') === 'memcached' ? $memcachedServers : [],
|
||||||
[
|
|
||||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
|
||||||
'port' => env('MEMCACHED_PORT', 11211),
|
|
||||||
'weight' => 100,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'redis' => [
|
'redis' => [
|
||||||
|
Loading…
Reference in New Issue
Block a user