[英]How do I tell Spring Cache to cache the exceptions in @Cacheable annotation?
I need 3 separate caches: 我需要3个独立的缓存:
I've already defined the two caches 我已经定义了两个缓存
@Caching(cacheable = {
@Cacheable(value = "SomeCache", key = "#a1", unless = "#result == null"),
@Cacheable(value = "SomeNullCache", key = "#a1", unless = "#result != null")})
So, I have to implement the last case. 所以,我必须实施最后一个案例。
JSR-107 provides @CacheResult annotation with exceptionCacheName attribute, but how can I do this using Spring Cache? JSR-107提供带有exceptionCacheName属性的@CacheResult注释,但是如何使用Spring Cache执行此操作? I don't want to combine JSR-107 and Spring Cache.
我不想将JSR-107和Spring Cache结合起来。
The cache abstraction does not support caching exception throw by annotated method. 缓存抽象不支持通过带注释的方法缓存异常抛出。 Your setup looks very weird to me.
你的设置看起来很奇怪。 Why would you use two different regions for null and non-null values?
为什么要将两个不同的区域用于null和non-null值?
Use the standard annotation if you want such setup. 如果需要这样的设置,请使用标准注释。
I don't want to combine JSR-107 and Spring Cache.
我不想将JSR-107和Spring Cache结合起来。
The id generation being different (to be spec compliant and keeping backward compatibility), I wouldn't recommend such usage. id生成不同(符合规范并保持向后兼容性),我不推荐这样的用法。 At least not on the same region.
至少不在同一地区。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.