Authored by 郝肖肖

客服缓存 cache getBy

@@ -79,7 +79,7 @@ class AbstractAction extends Controller_Abstract @@ -79,7 +79,7 @@ class AbstractAction extends Controller_Abstract
79 79
80 //客服配置 80 //客服配置
81 protected function getCustomerServiceSwitch() { 81 protected function getCustomerServiceSwitch() {
82 - return $this->_useSession && empty($this->getCache('customerServiceSwitch')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client'; 82 + return $this->_useSession && empty($this->getCacheBy('customerServiceSwitch')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client';
83 } 83 }
84 /** 84 /**
85 * 封装一下获取get参数 85 * 封装一下获取get参数
@@ -297,6 +297,22 @@ class AbstractAction extends Controller_Abstract @@ -297,6 +297,22 @@ class AbstractAction extends Controller_Abstract
297 } 297 }
298 298
299 /** 299 /**
  300 + * 直接查询缓存,不对key做任何处理<php与node cache对接>
  301 + *
  302 + * @param string $key 键名
  303 + * @param bool $isMaster 控制是到主服务器取,还是到从服务器取缓存
  304 + * @return mixed
  305 + */
  306 + protected function getCacheBy($key, $isMaster = true)
  307 + {
  308 + if ($isMaster) {
  309 + return Cache::getBy($key, 'master');
  310 + } else {
  311 + return Cache::getBy($key, 'slave');
  312 + }
  313 + }
  314 +
  315 + /**
300 * 设置Session 316 * 设置Session
301 * 317 *
302 * @param string $name 名称 318 * @param string $name 名称
@@ -45,7 +45,7 @@ class UserModel @@ -45,7 +45,7 @@ class UserModel
45 } 45 }
46 46
47 public static function getCustomerServiceSwitch() { 47 public static function getCustomerServiceSwitch() {
48 - $customerServiceSwitch = USE_CACHE && empty(Cache::get('customerServiceSwitch')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client'; 48 + $customerServiceSwitch = USE_CACHE && empty(Cache::getBy('customerServiceSwitch')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client';
49 } 49 }
50 /** 50 /**
51 * 个人中心-左侧导航 51 * 个人中心-左侧导航