| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace app\admin\logic;
- use app\admin\model\dao\ShopCategory;
- use app\admin\model\dao\ShopGoodsSpec;
- use app\admin\model\dao\ShopGoodsSpecRelation;
- use app\admin\model\dao\ShopGoodsSpecType;
- use app\admin\model\dao\ShopGoodsType;
- use app\common\model\ShopGoods;
- use think\facade\Cache;
- use think\facade\Db;
- class ShopCategoryLogic
- {
- private static $CACHE_ID_KEY = "cache:shop_category:id:";
- public static function getCateById($id)
- {
- $key = self::$CACHE_ID_KEY . $id;
- if (Cache::has($key)) {
- return Cache::get($key);
- }
- $name = ShopCategory::getById($id);
- Cache::set($key, $name, 10 * 60);
- return $name;
- }
- public static function delIdCache($id)
- {
- $key = self::$CACHE_ID_KEY.$id;
- Cache::delete($key);
- }
- }
|