aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Memcached.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-04-16 12:16:45 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-04-16 12:16:47 +0100
commite03c3f4251e12043dcdb5497885e18e10bca8782 (patch)
tree146366c3b5007356ec45f9014be6f8f132466a25 /perllib/Memcached.pm
parent461430079384a10fb9e433dcc7581af2a56c0fac (diff)
Always set memcached namespace.
The namespace was only being set in the web loop, so cron scripts were accessing different memcached keys. In particular, the state list would be shared between instances on the same host.
Diffstat (limited to 'perllib/Memcached.pm')
-rw-r--r--perllib/Memcached.pm14
1 files changed, 4 insertions, 10 deletions
diff --git a/perllib/Memcached.pm b/perllib/Memcached.pm
index 150594a01..63f22a645 100644
--- a/perllib/Memcached.pm
+++ b/perllib/Memcached.pm
@@ -1,21 +1,15 @@
-#
# Memcached.pm:
-# Trying out memcached on FixMyStreet
-#
-# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
+# Tiny FixMyStreet memcached wrapper
package Memcached;
use strict;
use warnings;
use Cache::Memcached;
+use FixMyStreet;
-my ($memcache, $namespace);
-
-sub set_namespace {
- $namespace = shift;
-}
+my $memcache;
+my $namespace = FixMyStreet->config('FMS_DB_NAME') . ":";
sub instance {
return $memcache //= Cache::Memcached->new({