summaryrefslogtreecommitdiff
path: root/plugins/GeonamesPlugin.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-31 12:48:24 -0700
committerBrion Vibber <brion@pobox.com>2010-03-31 12:48:24 -0700
commitdf9eb4164aec6d63869dee7bfd5cfddf6d831618 (patch)
treec078b097143772da34a6660039e79e470f86325a /plugins/GeonamesPlugin.php
parent89bb05311685d1bab404300e600f61deb954e18c (diff)
parent3ed88938b95804ecadc62ed3a5f61a0863e2ff78 (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins/GeonamesPlugin.php')
-rw-r--r--plugins/GeonamesPlugin.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/GeonamesPlugin.php b/plugins/GeonamesPlugin.php
index 589462ed9..f018e2694 100644
--- a/plugins/GeonamesPlugin.php
+++ b/plugins/GeonamesPlugin.php
@@ -55,6 +55,8 @@ class GeonamesPlugin extends Plugin
public $username = null;
public $token = null;
public $expiry = 7776000; // 90-day expiry
+ public $cachePrefix = null; // Optional shared memcache prefix override
+ // to share lookups between local instances.
/**
* convert a name into a Location object
@@ -408,9 +410,14 @@ class GeonamesPlugin extends Plugin
function cacheKey($attrs)
{
- return common_cache_key('geonames:'.
- implode(',', array_keys($attrs)) . ':'.
- common_keyize(implode(',', array_values($attrs))));
+ $key = 'geonames:' .
+ implode(',', array_keys($attrs)) . ':'.
+ common_keyize(implode(',', array_values($attrs)));
+ if ($this->cachePrefix) {
+ return $this->cachePrefix . ':' . $key;
+ } else {
+ return common_cache_key($key);
+ }
}
function wsUrl($method, $params)