What I did was the following
First add a helpers file app/Http/helpers.php and add to your composer
"autoload": {
...
"files": [
"app/Http/helpers.php"
]
}
In app/Http/helpers.php
/**
* Return the environment specific list of memcached servers
*/
function memcachedServers()
{
if (env('APP_ENV') == 'local') {
return [
[
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
],
];
}
if (env('APP_ENV') == 'development') {
return [
['host' => '127.0.0.1', 'port' => 11211, 'weight' => 100],
['host' => '127.0.0.2', 'port' => 11211, 'weight' => 100],
];
}
if (env('APP_ENV') == 'production') {
return [
[
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
],
];
}
}
In config/cache.php
'memcached' => [
'driver' => 'memcached',
'servers' => memcachedServers()
],