diff options
author | Sam Pearson <sam@sgp.me.uk> | 2018-09-20 12:08:16 +0100 |
---|---|---|
committer | Sam Pearson <sam@sgp.me.uk> | 2018-09-20 14:19:16 +0100 |
commit | 785c6cebec327ebf1518c08f1447dbd12224b952 (patch) | |
tree | 0d5a33bd118907d99ce89a5dd5b6e9f6be413af2 /perllib/Memcached.pm | |
parent | 1de47094d7a569c0055c0d23657140772c87d93d (diff) |
Add configuration option for memcached host
Previously we assumed that any memcache instance would be running on
the local loopback interface. This commit makes this configurable with
a `MEMCACHED_HOST` option. If left unset, this will default to
`127.0.0.1`.
Diffstat (limited to 'perllib/Memcached.pm')
-rw-r--r-- | perllib/Memcached.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/perllib/Memcached.pm b/perllib/Memcached.pm index 63f22a645..05ceeb615 100644 --- a/perllib/Memcached.pm +++ b/perllib/Memcached.pm @@ -10,10 +10,11 @@ use FixMyStreet; my $memcache; my $namespace = FixMyStreet->config('FMS_DB_NAME') . ":"; +my $server = FixMyStreet->config('MEMCACHED_HOST') || '127.0.0.1'; sub instance { return $memcache //= Cache::Memcached->new({ - 'servers' => [ '127.0.0.1:11211' ], + 'servers' => [ "${server}:11211" ], 'namespace' => $namespace, 'debug' => 0, 'compress_threshold' => 10_000, |