caffeine-cache

Dynamically toggling recording stats on Caffeine Cache

陌路散爱 提交于 2021-02-11 13:52:43
问题 I would like to be able to dynamically toggle the recording of stats of Caffeine Caches on demand via REST endpoint, or JMX Method We have a large scale application where we use several instances of Caffeine Caches. We could use every possible performance upgrade, so having it in constant recording seems redundant. Especially if JavaDoc says recording has a performance cost. After my analysis I think it is not directly supported. Or is it? I have 2 goals for stats, 1st one is to be able to

Dynamically toggling recording stats on Caffeine Cache

我是研究僧i 提交于 2021-02-11 13:51:31
问题 I would like to be able to dynamically toggle the recording of stats of Caffeine Caches on demand via REST endpoint, or JMX Method We have a large scale application where we use several instances of Caffeine Caches. We could use every possible performance upgrade, so having it in constant recording seems redundant. Especially if JavaDoc says recording has a performance cost. After my analysis I think it is not directly supported. Or is it? I have 2 goals for stats, 1st one is to be able to

Caffeine Cache in Spring Boot Cache : Get all cached keys

与世无争的帅哥 提交于 2021-02-10 20:42:30
问题 I'm using Caffeine Cache library for Spring Cache. Is there a way to get all the cached keys? My current application works on a near-realtime data, with the flow as : In the Cache Updater Thread (which runs at a fixed interval, irrespective of the user request), I need to get all the keys currently in the Cache, fetch their latest data from Db & then use @CachePut to update the cache. 回答1: Yo can inject CacheManager and obtain native cache from it. @AllArgsConstructor class Test { private

Caffeine Cache in Spring Boot Cache : Get all cached keys

為{幸葍}努か 提交于 2021-02-10 20:41:48
问题 I'm using Caffeine Cache library for Spring Cache. Is there a way to get all the cached keys? My current application works on a near-realtime data, with the flow as : In the Cache Updater Thread (which runs at a fixed interval, irrespective of the user request), I need to get all the keys currently in the Cache, fetch their latest data from Db & then use @CachePut to update the cache. 回答1: Yo can inject CacheManager and obtain native cache from it. @AllArgsConstructor class Test { private

Set cache expireAfterWrite property dynamically - Caffeine and Spring WebFlux

守給你的承諾、 提交于 2021-01-29 09:41:11
问题 I am using caffeine cache to store an authorisation token that has been obtained using webClient WebFlux. I have set the expireAfterWrite to a hardcoded value in the application.yml file as follows: spring: cache: cache-names: accessTokens caffeine: spec: expireAfterWrite=100m The token is obtained using a WebClient with Spring WebFlux as below code depicts: @Autowired var cacheManager: CacheManager? = null override fun getAuthToken(): Mono<AccessToken> { val map = LinkedMultiValueMap<String,

Spring cloud gateway with Spring cache and caffeine

試著忘記壹切 提交于 2021-01-07 01:23:09
问题 I have a spring cloud gateway which forwards the API rest requests to some microservices. I would like to cache the response for specific requests. For this reason I wrote this Filter @Component @Slf4j public class CacheResponseGatewayFilterFactory extends AbstractGatewayFilterFactory<CacheResponseGatewayFilterFactory.Config> { private final CacheManager cacheManager; public CacheResponseGatewayFilterFactory(CacheManager cacheManager) { super(CacheResponseGatewayFilterFactory.Config.class);

Spring cloud gateway with Spring cache and caffeine

橙三吉。 提交于 2021-01-07 01:23:00
问题 I have a spring cloud gateway which forwards the API rest requests to some microservices. I would like to cache the response for specific requests. For this reason I wrote this Filter @Component @Slf4j public class CacheResponseGatewayFilterFactory extends AbstractGatewayFilterFactory<CacheResponseGatewayFilterFactory.Config> { private final CacheManager cacheManager; public CacheResponseGatewayFilterFactory(CacheManager cacheManager) { super(CacheResponseGatewayFilterFactory.Config.class);

Spring cloud gateway with Spring cache and caffeine

北城余情 提交于 2021-01-07 01:22:35
问题 I have a spring cloud gateway which forwards the API rest requests to some microservices. I would like to cache the response for specific requests. For this reason I wrote this Filter @Component @Slf4j public class CacheResponseGatewayFilterFactory extends AbstractGatewayFilterFactory<CacheResponseGatewayFilterFactory.Config> { private final CacheManager cacheManager; public CacheResponseGatewayFilterFactory(CacheManager cacheManager) { super(CacheResponseGatewayFilterFactory.Config.class);