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

SpringBoot Cache: specific configuration for each cache

I am experimenting Cache in Spring Boot. At moment, I am using Caffeine implementation. From what I've read from the documentation, I've configured the caches in YAML as follows: spring: cache: cache-names: - skills -…
Rafael Afonso
  • 595
  • 1
  • 10
  • 28
0
votes
1 answer

Caching (Caffeine) & Spring - two caches based on method parameter value

I have a question about caching in spring using Caffeine. I have a cache configuration: @Configuration public class CaffeineCacheConfig { @Bean public CacheManager cacheManager() { CaffeineCacheManager cacheManager = new…
hc0re
  • 1,806
  • 2
  • 26
  • 61
0
votes
0 answers

How to add a new cache to a CaffeineCacheManager

I'm looking to dynamically add new caches to an already initialized CaffeineCacheManager instance. The class doesn't seem to have an obvious method to do this. I could add a new cache name via CaffeineCacheManager.getCacheNames().add() but i'm not…
Maurice
  • 6,698
  • 9
  • 47
  • 104
0
votes
1 answer

Retain old value when refreshing cache?

I have a Caffeine AsyncLoadingCache created with a refreshAfterWrite configured. For a given key, if a value is already loaded into the cache and there is an error during refresh, the key/value gets removed. Instead of this, I would like to retain…
user3380364
  • 65
  • 1
  • 5
0
votes
1 answer

Caffeine cache, what happens when i try to read an entry which eviction is performing on

I'm using this to create my cache: Cache cache = newBuilder() .expireAfterWrite(getCacheMaxNbDays(), DAYS) .maximumSize(getCacheMaxSize()) .build(); I was wondering what happens when I…
0
votes
1 answer

Spring 4 support for Caffeine Cache

I was trying to find some examples and evidence if Spring 4.0.3 version support caffeine cache integration? If yes, what caffeine cache version is supported for Spring 4.0.3?
Sam
  • 127
  • 2
  • 15
0
votes
1 answer

Caffeine cache with spring boot not working

I've set up a scenario using caffeine cache and I can't get it working, the real method is always called when the parameters are the same. Here is my config: pom.xml ... org.springframework.boot
dhalfageme
  • 1,444
  • 4
  • 21
  • 42
0
votes
1 answer

Caffeine async cache wih Spring Boot CacheManager

I am trying to use Spring Boot CacheManager with Caffeine and some @Cacheable annotated functions. In our tests, asynchronous calls to our controllers endpoints are having issues that seem to be related to the fact that we were using a…
Béatrice Cassistat
  • 1,048
  • 12
  • 37
0
votes
1 answer

Spring boot, Update/override application.properties value programatically/dynamically (JAVA)

I am using Spring boot. Application uses JWT token(another micro service) for authentication. I have to implement caching of JWT token. I am using Caffeine Cache. Problem: Now the problem is this token expiry time is always dynamic and i have to…
DKS
  • 306
  • 1
  • 2
  • 16
0
votes
1 answer

java byte:I can't understand the usage here

byte: Why, what's the use of doing this { byte p000, p001, p002, p003, p004, p005, p006, p007; ... } /** The namespace for field padding through inheritance. */ final class BLCHeader { abstract static class PadDrainStatus extends…
ke xu
  • 21
  • 1
0
votes
0 answers

Use caffeine cache instance in a separate java class/file?

Is there a way to use the same instance of a cache in a different file? When I create a cache in Main.java, and write it like this: public class Main { public Cache cache = Caffeine.newBuilder() .expireAfterWrite(2,…
Pro Poop
  • 357
  • 5
  • 14
0
votes
1 answer

java.lang.NoClassDefFoundError while using caffeine

I was making a Minecraft plugin (with maven) and was going to use caffeine for a cache, but when I ran my server with the plugin jar, I got the error: java.lang.NoClassDefFoundError: com/github/benmanes/caffeine/cache/Caffeine I am updated to the…
Pro Poop
  • 357
  • 5
  • 14
0
votes
1 answer

How to customize expireAfterWrite for concrete cache if I use cacheBuilder?

Based on this answer I try to use customized expireAfterWrite for "customCache" So my config look like this: @Configuration @EnableCaching public class CaffeineCacheConfig { ... @Bean public CaffeineCacheManager…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
0 answers

How to use Guava Cache optimally when you have to serve multiple results from data?

I have a cache loader which caches the response( which is in form of a list) from APIs. Now my functions do not need this response data directly, so I made a provider which can process these raw response and act as an oracle which allows me to send…
0
votes
0 answers

How can I use the grouped Caffeine Cache or ConcurrentHashMap?

I would like to cache the following data entity map object for each userId. /** * Example data object */ data class Data( val id: Int, val name: String, val age: Int ) As one of the ideas, I considered the following cache in Caffeine. /** …
1 2 3
8 9