Authored by hf

fixes bug to home page login show status

... ... @@ -20,8 +20,9 @@ class GradeModel
$result = array();
if (USE_CACHE) {
$key = CacheConfig::KEY_ACTION_HOME_GRADE . strval($uid);
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_HOME_GRADE, 'master');
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
... ... @@ -72,11 +73,11 @@ class GradeModel
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_ACTION_HOME_GRADE, 'slave');
$result = Cache::get($key, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_ACTION_HOME_GRADE, $result);
Cache::set($key, $result);
}
}
... ... @@ -91,8 +92,9 @@ class GradeModel
$result = array();
if (USE_CACHE) {
$key = CacheConfig::KEY_ACTION_HOME_PREFERENTIAL . strval($uid);
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_HOME_PREFERENTIAL, 'master');
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
... ... @@ -107,11 +109,11 @@ class GradeModel
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_ACTION_HOME_PREFERENTIAL, 'slave');
$result = Cache::get($key, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_ACTION_HOME_PREFERENTIAL, $result);
Cache::set($key, $result);
}
}
... ...