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
0
votes
1 answer

Delete Caffeine entries based on a timestamp condition

Is there a way to remove Caffeine entries based on a timestamp condition? Eg., At T1 I have following entries K1 -> V1 K2 -> V2 K3 -> V3 At time T2 I update only K2 and K3. (I dont know if both entries will have exact timestamp. K2 might have T2…
Boss Man
  • 587
  • 2
  • 12
0
votes
1 answer

Caffeine cache application.properties config vs CacheManager class config

I am currently learning caffeine and I am new to Spring in general. I've been trying to implement caching with caffeine; however, I find myself running into a few questions. I have seen two ways to configure the caffeine cache. First is with a Java…
zakpruitt
  • 162
  • 2
  • 11
0
votes
1 answer

Scaffeine: how to set different expiration time for default value

Scala application use case: We have a Scala based that module reads the data from global cache (Redis) and save the same into local cache(Scaffeine). As we want this data to be refreshed asynchronously, we are using LoadingCache with…
0
votes
1 answer

How do I make invalidate an entry and return its value from a Caffeine Cache?

I'm trying to remove an entry from the Caffeine cache manually. I have two attempts but I suspect that there are some problems with both of them: This one seems like it could suffer from a race condition. cache.get(key); cache.invalidate(key); This…
Anonymous Beaver
  • 370
  • 2
  • 10
0
votes
0 answers

Caffeine cache - put in the cache keys for values unreachable in the database?

my Caffeine cache works perfectly. But, i would like to improve its performances. In fact, many of keys i want to load from my cache are not in the database. Is there a way that Caffeine put all theses unreachable keys in the map, so that when i…
electrode
  • 205
  • 1
  • 4
  • 16
0
votes
0 answers

Be notified when an object is returned from SpringBoot cache

I am wondering if there is a built in way to know wheather or not an object is returned frome SpringBoot cache. I am using SpringBoot 2.2.2 and Caffeine 2.8.0. I am creating a Caffeine bean as follows: @Bean public Caffeine caffeineConfig() { …
Jacobs2000
  • 856
  • 2
  • 15
  • 25
0
votes
1 answer

Caffeine with Spring boot: How to cache a list of objects, update/delete an object using id and insert new objects to cache

I am newbie at Caffeine and Spring boot. I am trying to find a solution to cache a list of objects. the DB transaction takes 3 seconds to load the list, so I am looking to cache the resultset using Caffeine. To cache each item individually, I am…
0
votes
0 answers

How can I make Caffeine async?

@Bean public CacheManager cacheManager() { CaffeineCacheManager caffeineCacheManager = new CaffeineCacheManager(); caffeineCacheManager.getCache("addresses"); caffeineCacheManager.setCacheLoader(cacheLoader()); …
0
votes
1 answer

Is there a Caffeine feature that will purge a particular item from the cache after defined time and recreates it at the same time?

ExpireAfter will only purge the item but will not re-create the item. So what I need to do is, after a predefined interval, I need to purge a particular item from the cache and at the same time I need to recreate it. It might recreate with same…
Ven
  • 1
  • 3
0
votes
2 answers

Can I schedule Java Spring Cache to expire at the top of each hour like a CRON job?

I have it currently set up to expire after 12 hours. However, it expires 12 hours after each cache is first written too. I would like it to refresh at 12am and 12pm only. Is this possible? In my cacheConfig file I…
Brian Akumah
  • 144
  • 3
  • 12
0
votes
1 answer

Caffeine LoadingCache - Eviction with Custom expiration policy

Using Caffeine 2.8.1 and Java 8. I have created LoadingCache. I am loading the cache with cache.putAll(getAllKeyValues()) where getAllKeyValues() returns a Map. I have specified a CacheLoader to compute the value by…
Kuldeep Jain
  • 8,409
  • 8
  • 48
  • 73
0
votes
1 answer

Caffeine Cache: How to update cache value without changing expire time

I am using caffeine cache and looking for a way to update the value in cache without changing its expire time. The scenario is that I am using cache for speed up data loading. A 5 seconds' delay of data changing is acceptable while I expect returns…
Yoskyalogn
  • 1
  • 1
  • 2
0
votes
1 answer

Set cache expireAfterWrite property dynamically - Caffeine and Spring WebFlux

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 …
D.B
  • 4,009
  • 14
  • 46
  • 83
0
votes
1 answer

How to configure Caffeine Cache with Spring

I have a simple Spring application. I need to implement caching onto a few services that are expensive to call each time. I have a configuration class like this: @Configuration @EnableCaching public class CachingConfig { @Bean (name =…
Einstein_AB
  • 396
  • 5
  • 22
0
votes
1 answer

Caffeine cache in Play Framework doesn't return cached responses

I'm using Caffeine cache implementation with my java Play Framework job to cache outgoing http requests, and I see that in spite of the fact that the cache is up and running, my service still hit the external server every time instead of returning…
Battle_Slug
  • 2,055
  • 1
  • 34
  • 60
1 2 3
8
9