allow a configured base for cache keys
This commit is contained in:
parent
177e4adf40
commit
fd290fc3f9
7
README
7
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
|
||||
------
|
||||
|
|
|
@ -152,6 +152,7 @@ $config =
|
|||
'memcached' =>
|
||||
array('enabled' => false,
|
||||
'server' => 'localhost',
|
||||
'base' => null,
|
||||
'port' => 11211),
|
||||
'ping' =>
|
||||
array('notify' => array()),
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user