diff options
author | Evan Prodromou <evan@status.net> | 2010-01-02 20:26:33 -1000 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-01-02 20:26:33 -1000 |
commit | c5d23e27a6a34e02090ebcece60dfa5b7f814488 (patch) | |
tree | 5af47be46eb593bfedce94d5a9d9d1b9631eb681 /lib/util.php | |
parent | 7b452e4f7142c0a2b580b174cbab5d51ab7f9d1e (diff) |
Make caching a plugin system
Diffstat (limited to 'lib/util.php')
-rw-r--r-- | lib/util.php | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/lib/util.php b/lib/util.php index 22dc0f934..63656b604 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1384,42 +1384,17 @@ function common_session_token() function common_cache_key($extra) { - $base_key = common_config('memcached', 'base'); - - if (empty($base_key)) { - $base_key = common_keyize(common_config('site', 'name')); - } - - return 'statusnet:' . $base_key . ':' . $extra; + return Cache::key($extra); } function common_keyize($str) { - $str = strtolower($str); - $str = preg_replace('/\s/', '_', $str); - return $str; + return Cache::keyize($str); } function common_memcache() { - static $cache = null; - if (!common_config('memcached', 'enabled')) { - return null; - } else { - if (!$cache) { - $cache = new Memcache(); - $servers = common_config('memcached', 'server'); - if (is_array($servers)) { - foreach($servers as $server) { - $cache->addServer($server); - } - } else { - $cache->addServer($servers); - } - $cache->setCompressThreshold(20000, 0.2); - } - return $cache; - } + return Cache::instance(); } function common_license_terms($uri) |