Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2016-03-05 09:47:24 +0000
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
479dd80a8c0a971e5fc5db8679f3677205e44109
479dd80a
1 parent
069431db
Made memcached config allow mulitple servers
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
.env.example
config/cache.php
.env.example
View file @
479dd80
...
...
@@ -17,6 +17,12 @@ SESSION_DRIVER=file
#SESSION_DRIVER=memcached
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_TYPE=local
# Amazon S3 Config
...
...
@@ -57,8 +63,3 @@ MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
\ No newline at end of file
# 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
\ No newline at end of file
...
...
config/cache.php
View file @
479dd80
<?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
[
/*
...
...
@@ -49,13 +62,7 @@ return [
'memcached'
=>
[
'driver'
=>
'memcached'
,
'servers'
=>
[
[
'host'
=>
env
(
'MEMCACHED_HOST'
,
'127.0.0.1'
),
'port'
=>
env
(
'MEMCACHED_PORT'
,
11211
),
'weight'
=>
100
,
],
],
'servers'
=>
env
(
'CACHE_DRIVER'
)
===
'memcached'
?
$memcachedServers
:
[],
],
'redis'
=>
[
...
...
Please
register
or
sign in
to post a comment