From f0185f5d17ebd739d315dbf9c048fd068ae228e0 Mon Sep 17 00:00:00 2001 From: DongZeLiang <2746733890@qq.com> Date: Tue, 2 Apr 2024 11:27:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../muyu-shop-cart-cache/pom.xml | 34 +++++++ .../com/muyu/shop/cart/cache/CartCache.java | 96 +++++++++++++++++++ .../muyu/shop/cart/cache/key/CartHashKey.java | 28 ++++++ muyu-modules/muyu-shop-cart/pom.xml | 1 + pom.xml | 7 ++ 5 files changed, 166 insertions(+) create mode 100644 muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/pom.xml create mode 100644 muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/src/main/java/com/muyu/shop/cart/cache/CartCache.java create mode 100644 muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/src/main/java/com/muyu/shop/cart/cache/key/CartHashKey.java diff --git a/muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/pom.xml b/muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/pom.xml new file mode 100644 index 0000000..aa82df5 --- /dev/null +++ b/muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + + com.muyu + muyu-shop-cart + 3.6.3 + + + muyu-shop-cart-cache + + + 17 + 17 + UTF-8 + + + + + + com.muyu + muyu-shop-cart-common + + + + + com.muyu + muyu-common-cache + + + + diff --git a/muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/src/main/java/com/muyu/shop/cart/cache/CartCache.java b/muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/src/main/java/com/muyu/shop/cart/cache/CartCache.java new file mode 100644 index 0000000..ac49f08 --- /dev/null +++ b/muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/src/main/java/com/muyu/shop/cart/cache/CartCache.java @@ -0,0 +1,96 @@ +package com.muyu.shop.cart.cache; + +import com.muyu.common.cache.abs.HashCacheAbs; +import com.muyu.shop.cart.cache.key.CartHashKey; +import com.muyu.shop.cart.domain.CartInfo; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * @author DongZl + * @description: 购物车缓存 + * @Date 2024-4-2 上午 11:23 + */ +@Component +public class CartCache extends HashCacheAbs { + + + /** + * key前缀 + * @return key前缀 + */ + @Override + public String keyPre () { + return null; + } + + /** + * 解码 + * @param redisKey 数据库键 + * @return ID + */ + @Override + public Long decode (String redisKey) { + return null; + } + + /** + * 编码 + * + * @param hashKey ID + * + * @return 键 + */ + @Override + public String encodeHashKey (CartHashKey hashKey) { + return null; + } + + /** + * 解码 + * @param redisHashKey 数据库键 + * @return ID + */ + @Override + public CartHashKey decodeHashKey (String redisHashKey) { + return null; + } + + /** + * 通过键获取所有的hash数据 + * @param key 键 + * @return + */ + @Override + public Map getData (Long key) { + return null; + } + + /** + * 通过缓存键和hash键获取hash值 + * + * @param key 缓存键 + * @param hashKey hash键 + * + * @return hash值 + */ + @Override + public CartInfo getData (Long key, CartHashKey hashKey) { + return null; + } + + /** + * 默认值 + */ + @Override + public Map defaultValue () { + return null; + } + + @Override + public CartInfo defaultHashValue () { + return null; + } + +} diff --git a/muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/src/main/java/com/muyu/shop/cart/cache/key/CartHashKey.java b/muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/src/main/java/com/muyu/shop/cart/cache/key/CartHashKey.java new file mode 100644 index 0000000..69fcdf5 --- /dev/null +++ b/muyu-modules/muyu-shop-cart/muyu-shop-cart-cache/src/main/java/com/muyu/shop/cart/cache/key/CartHashKey.java @@ -0,0 +1,28 @@ +package com.muyu.shop.cart.cache.key; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author DongZl + * @description: 购物车HashKey + * @Date 2024-4-2 上午 11:25 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CartHashKey { + + /** + * 商品ID + */ + private Long projectId; + + /** + * 商品SKU + */ + private String projectSku; +} diff --git a/muyu-modules/muyu-shop-cart/pom.xml b/muyu-modules/muyu-shop-cart/pom.xml index d944d40..a3d4074 100644 --- a/muyu-modules/muyu-shop-cart/pom.xml +++ b/muyu-modules/muyu-shop-cart/pom.xml @@ -15,6 +15,7 @@ muyu-shop-cart-common muyu-shop-cart-remote muyu-shop-cart-server + muyu-shop-cart-cache diff --git a/pom.xml b/pom.xml index e4eda55..818b6c1 100644 --- a/pom.xml +++ b/pom.xml @@ -248,6 +248,13 @@ ${muyu.version} + + + com.muyu + muyu-shop-cart-cache + ${muyu.version} + +