summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-15 16:09:40 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-06-15 16:09:40 -0700
commitfd290fc3f9a40a0d3be4e4ffc7d11846bf5295b8 (patch)
treef8195551fabc58d95272f980bd0f6cf423870763
parent177e4adf40bd41fc711c91fc6d16729b7f1b5796 (diff)
allow a configured base for cache keys
-rw-r--r--README7
-rw-r--r--lib/common.php1
-rw-r--r--lib/util.php8
3 files changed, 15 insertions, 1 deletions
diff --git a/README b/README
index 5b6b847c8..57ff72f66 100644
--- a/README
+++ b/README
@@ -1106,6 +1106,13 @@ database data in memcached <http://www.danga.com/memcached/>.
enabled: Set to true to enable. Default false.
server: a string with the hostname of the memcached server. Can also
be an array of hostnames, if you've got more than one server.
+base: memcached uses key-value pairs to store data. We build long,
+ funny-looking keys to make sure we don't have any conflicts. The
+ base of the key is usually a simplified version of the site name
+ (like "Identi.ca" => "identica"), but you can overwrite this if
+ you need to. You can safely ignore it if you only have one
+ Laconica site using your memcached server.
+port: Port to connect to; defaults to 11211.
sphinx
------
diff --git a/lib/common.php b/lib/common.php
index ab61c812f..51204cede 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -152,6 +152,7 @@ $config =
'memcached' =>
array('enabled' => false,
'server' => 'localhost',
+ 'base' => null,
'port' => 11211),
'ping' =>
array('notify' => array()),
diff --git a/lib/util.php b/lib/util.php
index 49c6ae108..1d5708bd6 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1322,7 +1322,13 @@ function common_session_token()
function common_cache_key($extra)
{
- return 'laconica:' . common_keyize(common_config('site', 'name')) . ':' . $extra;
+ $base_key = common_config('memcached', 'base');
+
+ if (empty($base_key)) {
+ $base_key = common_keyize(common_config('site', 'name'));
+ }
+
+ return 'laconica:' . $base_key . ':' . $extra;
}
function common_keyize($str)