Merge pull request #45 from radiorabe/feature/remove-pref-cache-in-mvc

completely remove deactivated cache
This commit is contained in:
Robb 2017-03-09 20:37:42 -05:00 committed by GitHub
commit be00c68ed0
3 changed files with 0 additions and 60 deletions

View file

@ -1,45 +0,0 @@
<?php
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}";
}
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;
}
public static function clear()
{
// Disabled on SaaS
// apc_clear_cache('user');
// apc_clear_cache();
}
}

View file

@ -23,7 +23,6 @@ class Application_Model_Preference
*/
private static function setValue($key, $value, $isUserValue = false)
{
$cache = new Cache();
$con = Propel::getConnection(CcPrefPeer::DATABASE_NAME);
//We are using row-level locking in Postgres via "FOR UPDATE" instead of a transaction here
@ -109,8 +108,6 @@ class Application_Model_Preference
Logging::info("Database error: ".$e->getMessage());
exit;
}
$cache->store($key, $value, $isUserValue, $userId);
}
/**
@ -143,8 +140,6 @@ class Application_Model_Preference
*/
private static function getValue($key, $isUserValue = false, $forceDefault = false)
{
$cache = new Cache();
try {
$userId = null;
@ -156,10 +151,6 @@ class Application_Model_Preference
}
}
// If the value is already cached, return it
$res = $cache->fetch($key, $isUserValue, $userId);
if ($res !== false) return $res;
//Check if key already exists
$sql = "SELECT COUNT(*) FROM cc_pref"
." WHERE keystr = :key";
@ -198,7 +189,6 @@ class Application_Model_Preference
$res = ($result !== false) ? $result : "";
}
$cache->store($key, $res, $isUserValue, $userId);
return $res;
}
catch (Exception $e) {