From 792894062656520eec8d15276a54728be450fe5c Mon Sep 17 00:00:00 2001 From: jinceon Date: Fri, 14 Jul 2023 06:07:15 +0000 Subject: [PATCH] =?UTF-8?q?add=20Java/cache-service.java.=20=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=B1=82=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Java/cache-service.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Java/cache-service.java diff --git a/Java/cache-service.java b/Java/cache-service.java new file mode 100644 index 0000000..14dcde2 --- /dev/null +++ b/Java/cache-service.java @@ -0,0 +1,24 @@ +public class XXXServiceImpl implements XXXService { + + // 某团队的规范 + // 当你想使用缓存的时候,不允许在这里加@Cacheable,必须新增一个cache层 + @Override + public XXX xxx(String id) { + return xxxService.xxx(id); + } +} + + + + +public class XXXCacheServiceImpl implements XXXCacheService { + + @Autowired + private XXXService xxxService; + + @Override + @Cacheable(value = "auth", key = "targetClass.name+'_'+#id", unless = "#result eq null") + public XXX xxx(String id) { + return xxxService.xxx(id); + } +} -- Gitee