From fd290fc3f9a40a0d3be4e4ffc7d11846bf5295b8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 15 Jun 2009 16:09:40 -0700 Subject: allow a configured base for cache keys --- README | 7 +++++++ lib/common.php | 1 + lib/util.php | 8 +++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README b/README index 5b6b847c8..57ff72f66 100644 --- a/README +++ b/README @@ -1106,6 +1106,13 @@ database data in 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) -- cgit v1.2.3-54-g00ecf