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
1
vote
0 answers

Caffeine cache X509Certificate

I'm developing an option in one project that encrypts some data using X509Certificate. This project uses Spring Boot. I do encryption with BouncyCastle library. To encrypt data I have to download recipient's certificate from some server. That's…
Nick
  • 11
  • 1
1
vote
1 answer

Caffeine: Use stale values when AsyncLoader fails to refresh

I want to configure my Caffeine cache to return stale results when loader fails to refresh the cache. The following Kotlin code demonstrates the case: @Test fun `completeble future`() = runBlocking { val cache =…
alisabzevari
  • 8,008
  • 6
  • 43
  • 67
1
vote
1 answer

Caffeine cache, perform eviction of expired element only when put succeds

I use Caffeine cache to cache data coming from the DB that need to served to a rest endpoint. So the cache is updated ONLY on read operations on the DB. In the nominal case, I want the cache to take the lead of responding until the data is not older…
Monta
  • 1,136
  • 1
  • 12
  • 28
1
vote
2 answers

Caffeine Cache - How to get information of creation date of an element

Is there any way to access the creation timestamp of an element from the CaffeineCache? Kind of cache.get("x").getTimestamp()?
Monta
  • 1,136
  • 1
  • 12
  • 28
1
vote
1 answer

Caffeine eviction by size seems to not work

I am using caffeine cache. I want to put it under size limitation but it does not work properly. test 1: Cache cache = Caffeine.newBuilder() .maximumSize(3) .build(); Cache
Ido Barash
  • 4,856
  • 11
  • 41
  • 78
1
vote
0 answers

Does Spring boot 2.2.4 support Caffeine AsyncCache implementation

I have just started working with Caffeine. I see CaffeineCache class in Spring Boot only support implementations of Cache interface from Caffeine as shown in the code below, but I would like to know if Spring Boot supports implementations of…
1
vote
0 answers

Caffeine: Memoize or Cache Builder a Big List of Items?

As a disclaimer, I'm new to Caffeine and exploring out this lightweight approach. I have a collection that is fetched from a database that consists of more than 20K of simple ItemLOV two-attribute objects. They are pulled, converted / cast…
Melvin Mah
  • 105
  • 2
  • 13
1
vote
1 answer

Caffeine cache "cannot be cast to org.springframework.cache.Cache"

I am attempting to use Spring Boot caching. I have a cached class: @Component public class GlobalAssetIdCache { private static final Logger LOG = LogManager.getLogger(GlobalAssetIdCache.class); @Cacheable(value = "GLOBAL_ASSET_ID",…
markthegrea
  • 3,731
  • 7
  • 55
  • 78
1
vote
0 answers

CaffeineCache is not refreshed immediately after put operation in Spring Boot application

I have a random issue with CaffeineCache in my Spring Boot application. The problem is with an integration test that makes next find user delete it find it again It seems that sometimes cache doesn't not refreshes on time before the second call…
Vitalii
  • 10,091
  • 18
  • 83
  • 151
1
vote
1 answer

Testing Spring Boot Cache(Caffeine)

I have my cache config as below; @Configuration public class CacheConfiguration { @Bean public CacheManager cacheManager(Ticker ticker) { CaffeineCache bookCache = buildCache("books", ticker, 30); SimpleCacheManager…
Rajkishan Swami
  • 3,569
  • 10
  • 48
  • 68
0
votes
0 answers

How to update Caffeine cache every N minutes?

I have currently this code for Caffeine cache(I want to have all rules from DB in my cache, since there is no lot of them): public class CaffeineCache { LoadingCache cache = Caffeine.newBuilder() .maximumSize(10_000) …
user6450105
0
votes
0 answers

How could I implement an equivalent to Caffeine's refreshAfterWrite behaviour using Hazelcast?

I'd like to effectively implement a "soft expiry" using Hazelcast, where if an entry was beyond a certain age, it would still be considered a cache hit and returned, but it would be asynchronously reloaded after being requested (effectively, the…
Chris Cooper
  • 869
  • 2
  • 18
  • 42
0
votes
0 answers

Caffeine cache yaml config expireAfterWrite not clearing the cache

This is my configuration In application.yaml spring: cache: cache-names: portalInfo caffeine: spec: maximumSize=500, expireAfterWrite=30s And In my repository I have @Cachable(key="'key1'",sync=true) List
0
votes
0 answers

Implement compression in caffeineCache springboot

I have implemented a caffeine cache in spring boot. This cache holds up to 30k elements. This affects the performance. Hence I want to implement compression on the values it stores. Please advise. here is my config…
manjosh
  • 438
  • 6
  • 28
0
votes
0 answers

Caffeine cache thread safety

From this doc, looks like caffeine cache is thread safe, when using manual cache population cache.put(key, value), what happens if put failed due to another thread is writing to the same key? (Or will it fail due to another thread is accessing the…
Yituo
  • 1,458
  • 4
  • 17
  • 26
1 2 3
8 9