Nerf the APC cache on SaaS

* We have multiple webservers on SaaS so we need a distributed data
  cache like memcached.
* Fixes CC-5671: Live streaming: UI won't update connection status unless reload apache2
This commit is contained in:
Albert Santoni 2014-01-29 17:19:24 -05:00
parent a0cae1d8f3
commit 03015a6b69
1 changed files with 33 additions and 27 deletions

View File

@ -2,31 +2,37 @@
class Cache
{
private function createCacheKey($key, $isUserValue, $userId = null) {
$CC_CONFIG = Config::getConfig();
$a = $CC_CONFIG["apiKey"][0];
if ($isUserValue) {
$cacheKey = "{$key}{$userId}{$a}";
}
else {
$cacheKey = "{$key}{$a}";
}
private function createCacheKey($key, $isUserValue, $userId = null) {
$CC_CONFIG = Config::getConfig();
$a = $CC_CONFIG["apiKey"][0];
if ($isUserValue) {
$cacheKey = "{$key}{$userId}{$a}";
}
else {
$cacheKey = "{$key}{$a}";
}
return $cacheKey;
}
public function store($key, $value, $isUserValue, $userId = null) {
$cacheKey = self::createCacheKey($key, $userId);
return apc_store($cacheKey, $value);
}
public function fetch($key, $isUserValue, $userId = null) {
$cacheKey = self::createCacheKey($key, $isUserValue, $userId);
return apc_fetch($cacheKey);
}
}
return $cacheKey;
}
public function store($key, $value, $isUserValue, $userId = null) {
$cacheKey = self::createCacheKey($key, $userId);
//XXX: Disabling APC on SaaS because it turns out we have multiple webservers
// running, which means we have to use a distributed data cache like memcached.
//return apc_store($cacheKey, $value);
return false;
}
public function fetch($key, $isUserValue, $userId = null) {
$cacheKey = self::createCacheKey($key, $isUserValue, $userId);
//XXX: Disabling APC on SaaS because it turns out we have multiple webservers
// running, which means we have to use a distributed data cache like memcached.
//return apc_fetch($cacheKey);
return false;
}
}