diff --git a/Java/cache-service.java b/Java/cache-service.java new file mode 100644 index 0000000000000000000000000000000000000000..14dcde2e57990bf220ccccf21184f6b3ac58d249 --- /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); + } +}