-
-
Save jeffandersen/8329f166b2d9b8369fe06616c60be958 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//.. | |
'default' => env('CACHE_DRIVER', 'memcached'), | |
// ... | |
'memcached' => [ | |
'driver' => 'memcached', | |
'persistent_id' => 'memcached_pool_id', | |
'sasl' => [ | |
config('memcachier.MEMCACHIER_USERNAME'), | |
config('memcachier.MEMCACHIER_PASSWORD'), | |
], | |
'options' => [ | |
// some nicer default options | |
// - nicer TCP options | |
Memcached::OPT_TCP_NODELAY => TRUE, | |
Memcached::OPT_NO_BLOCK => FALSE, | |
// - timeouts | |
Memcached::OPT_CONNECT_TIMEOUT => 2000, // ms | |
Memcached::OPT_POLL_TIMEOUT => 2000, // ms | |
Memcached::OPT_RECV_TIMEOUT => 750 * 1000, // us | |
Memcached::OPT_SEND_TIMEOUT => 750 * 1000, // us | |
// - better failover | |
Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT, | |
Memcached::OPT_LIBKETAMA_COMPATIBLE => TRUE, | |
Memcached::OPT_RETRY_TIMEOUT => 2, | |
Memcached::OPT_SERVER_FAILURE_LIMIT => 1, | |
Memcached::OPT_AUTO_EJECT_HOSTS => TRUE, | |
], | |
'servers' => array_map(function($s) { | |
$parts = explode(":", $s); | |
return [ | |
'host' => $parts[0], | |
'port' => $parts[1], | |
'weight' => 100, | |
]; | |
}, explode(",", config('memcachier.MEMCACHIER_SERVERS'))) | |
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment