onlineEnterpriseId = $enterpriseId; $this->cache = Factory::cache('default'); } /** * @param $categoryId * @param $num * @return ResultWrapper */ public function cacheCategoryRelationGoodsBasicNum($categoryId, $num) { $result = $this->cache->zadd($this->categoryKey.'::'.$this->onlineEnterpriseId, $num, $categoryId); return $result; } /** * @param $categoryId * @return mixed */ public function categoryKeyScoreIncr($categoryId) { $result = $this->cache->zincrby($this->categoryKey.'::'.$this->onlineEnterpriseId, 1, $categoryId); return $result; } /** * @param $categoryId * @return mixed */ public function categoryKeyScoreDecr($categoryId) { $result = $this->cache->zincrby($this->categoryKey.'::'.$this->onlineEnterpriseId, -1, $categoryId); return $result; } /** * @param $categoryId * @return int */ public function getCategoryGoodsBasicNum($categoryId) { $result = $this->cache->zscore($this->categoryKey.'::'.$this->onlineEnterpriseId, $categoryId); return $result; } /**********************************************brand start*****************************************************************/ /** * @param $brandId * @param $num * @return mixed */ public function cacheBrandRelationGoodsBasicNum($brandId,$num) { $result = $this->cache->zadd($this->brandKey.'::'.$this->onlineEnterpriseId, $num, $brandId); if ($result == false){ return 0; } return $result; } /** * @param $brandId * @return mixed */ public function brandKeyScoreIncr($brandId) { $result = $this->cache->zincrby($this->brandKey.'::'.$this->onlineEnterpriseId, 1, $brandId); return $result; } /** * @param $brandId * @return mixed */ public function brandKeyScoreDecr($brandId) { $result = $this->cache->zincrby($this->brandKey.'::'.$this->onlineEnterpriseId, -1, $brandId); return $result; } /** * @param $brandId * @return mixed */ public function getBrandGoodsBasicNum($brandId) { $result = $this->cache->zscore($this->brandKey.'::'.$this->onlineEnterpriseId, $brandId); return $result; } }