completely remove deactivated cache

Cache handling has been disabled on saas-dev and 2.5.x at least for a while. This gets completely rid of it.

You should do caching on the byte-code level in PHP using the tool best fitting your needs and depending on the exact PHP version you are running this on.

Proper cache hygiene ist a routine part of maintenance and may need seperate addressing depending on the needs of your station.
This commit is contained in:
Lucas Bickel 2017-02-11 14:12:08 +01:00
parent 0f8c3b7c92
commit 21356d1894
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) {

View File

@ -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;
}