Description
Alexandre Navarro opened SPR-14856 and commented
Possibility to use org.springframework.cache.support.NoOpCacheManager.NoOpCache as public class as NoOpCacheManager.
I just explain my use case to use NoOpCache as a client.
I configure some caches via in my spring-boot microservice.
Some are server side, some are client side via interface designed with feign/spring-cloud annotation and @Cacheable
For server side, I want always to use cache.
For client side, depending of my microservice, I want to activate or not some caches, for instance, on a spring-batch microservice I want to cache. Just for information, my different interface of my feign client with @Cacheable
are shared between the different microservices via client jar of my microservice.
So my configuration should be in some case like
@Bean
public CacheManager cacheManager() {
final SimpleCacheManager cacheManager = new SimpleCacheManager();
cacheManager.setCaches(Arrays.asList(
new NoOpCacheManager.NoOpCache("bar"),
new ConcurrentMapCache("foo")));
return cacheManager;
}
Can you just see NoOpCache as public class or have something close.
Of course, I can have a basic NoOpCache on my side but it should be by default in spring-cache.
Affects: 4.3.3