Merge pull request #45 from radiorabe/feature/remove-pref-cache-in-mvc
completely remove deactivated cache
This commit is contained in:
commit
be00c68ed0
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -187,18 +187,15 @@ abstract class AirtimeUpgrader
|
|||
* allowing child classes to overwrite _runUpgrade to reduce duplication
|
||||
*/
|
||||
public function upgrade() {
|
||||
Cache::clear();
|
||||
assert($this->checkIfUpgradeSupported());
|
||||
|
||||
try {
|
||||
// $this->toggleMaintenanceScreen(true);
|
||||
Cache::clear();
|
||||
|
||||
$this->_getDbValues();
|
||||
$this->_runUpgrade();
|
||||
|
||||
Application_Model_Preference::SetSchemaVersion($this->getNewVersion());
|
||||
Cache::clear();
|
||||
|
||||
// $this->toggleMaintenanceScreen(false);
|
||||
} catch(Exception $e) {
|
||||
|
@ -215,7 +212,6 @@ abstract class AirtimeUpgrader
|
|||
* allowing child classes to overwrite _runDowngrade to reduce duplication
|
||||
*/
|
||||
public function downgrade() {
|
||||
Cache::clear();
|
||||
|
||||
try {
|
||||
$this->_getDbValues();
|
||||
|
@ -232,7 +228,6 @@ abstract class AirtimeUpgrader
|
|||
// Set the schema version to the highest supported version so we don't skip versions when downgrading
|
||||
Application_Model_Preference::SetSchemaVersion($highestSupportedVersion);
|
||||
|
||||
Cache::clear();
|
||||
} catch(Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue