Questions tagged [caffeine-cache]

A high-performance in-memory cache for Java and other JVM languages.

Caffeine is a cache library with near-optimal performance; flexible configuration; blocking and non-blocking APIs; and integration points for external persistence, monitoring, and plug-in operation with many popular frameworks.

128 questions
45
votes
4 answers

Is it possible to set a different specification per cache using caffeine in spring boot?

I have a simple sprint boot application using spring boot 1.5.11.RELEASE with @EnableCaching on the Application Configuration class. pom.xml org.springframework.boot
David
  • 7,652
  • 21
  • 60
  • 98
10
votes
3 answers

How to solve "Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache' warning?

How to solve Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it to the classpath. warning in spring boot?
Thirumal
  • 8,280
  • 11
  • 53
  • 103
7
votes
1 answer

How to cache null values in caffeine cache

I'm using Caffeine cache to store data received from an external system. LoadingCache clientCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build(id -> { System.out.println("Generating new value for " + id); …
Santosh Hegde
  • 3,420
  • 10
  • 35
  • 51
6
votes
1 answer

Spring Cache Caffeine bulk retrieval

Is it possible to use Caffeine's CacheLoader::loadAll with @Cacheable annotated method with collection parameter, like @Cacheable(cacheNames = "exampleCache", cacheManager="exampleCacheManager", keyGenerator = "complexKeyGenerator") List
dev123
  • 477
  • 8
  • 20
6
votes
2 answers

Caffeine Cache in Spring Boot Cache : Get all cached keys

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…
imAmanRana
  • 123
  • 1
  • 3
  • 9
4
votes
2 answers

What is the preferred way how to add Caffeine cache to kotlin with coroutines

I am trying to integrate Caffeine cache into kotlin+spring boot application, however, I am getting the problem of calling the suspension function in the non-coroutine body. I get this, but I am looking for a solution that should be a bit more…
Mejmo
  • 2,363
  • 9
  • 35
  • 54
3
votes
1 answer

Spring cloud gateway with Spring cache and caffeine

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…
Fabry
  • 1,498
  • 4
  • 23
  • 47
3
votes
1 answer

How do you define a Duration object in Micronaut's application YAML

I'm trying to define a caffiene cache in micronaut and set the expire time via the application yaml. The documentation indicates that micronaut.caches.discovery-client.expire-after-write should be defined as a Duration object but it's unclear how to…
ATaylor95
  • 105
  • 6
2
votes
1 answer

Use old/stale cache value if cache refresh is failed using caffine with spring

I have a requirement to use old/stale cache value if cache refresh is failed. I have gone through the many examples on internet and decided to try with caffeine cache to implement this requirements(more specifically using refreshAfterWrite feature).…
vishal
  • 71
  • 2
  • 7
2
votes
1 answer

What happens when Caffeine runs out of memory?

What happens when Caffeine runs out of memory during for example put operation? Is OutOfMemoryError exception thrown, or is the operation ignored? I could not find it stated explicitly in the documentation.
mikol
  • 185
  • 1
  • 10
2
votes
0 answers

refreshAfterWrite Cache in Spring Webflux

I am trying to create a Caffeine cache for my spring webflux application. Here is the implementation: private final Cache localCache = Caffeine.newBuilder() .expireAfterWrite(1, TimeUnit.MINUTES) …
2
votes
2 answers

Cache With Complex Conditional Eviction

I'm trying to use caffeine and spring-boot-starter-cache to implement the following caching logic: If expiration time has passed and condition (That requires computation and I/O) is evaluated to TRUE then force fetch the data and update cache. If…
Eyal Ringort
  • 601
  • 6
  • 19
2
votes
2 answers

How to set different specifications per cache at the application.properties layer in Caffeine Cache Spring Boot

Essentially, I have a few applications that will interact with the data layer independently. For each instance that is running, caching needs will likely be different. I know you can easily define different cacheManagers as an @Bean within its own…
zakpruitt
  • 162
  • 2
  • 11
2
votes
1 answer

How much cache can be stored using springboot and Caffeine cache?

We have developed an application using Springboot and used Springboot cache as well as Caffeine cache to reduce DB calls and improve performance, But we are thinking cache size may occur problem so kindly help us to know how much cache will work…
AmolRavan
  • 33
  • 6
2
votes
1 answer

Caffeine combining both scheduler and executor service

I am using caffeine in the following configuration: Cache cache = Caffeine.newBuilder() .executor(newWorkStealingPool(15)) .scheduler(createScheduler()) .expireAfterWrite(10,…
Roie Beck
  • 1,113
  • 3
  • 15
  • 30
1
2 3
8 9