0

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 class:

@Configuration
@EnableCaching
public class CachingConfig {
@Bean
public CacheManager cacheManager() {
    CaffeineCacheManager cacheManager = new CaffeineCacheManager();
    cacheManager.setCaffeine(Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) // Set the expiration time
            .maximumSize(30000).recordStats());
    cacheManager.setCacheNames(Collections.singletonList("my_cache"));

    return cacheManager;
}
}
manjosh
  • 438
  • 6
  • 28
  • What are the values? How big is each value? What is `CompressingCaffeineManager` (this class doesn't seem to exist in the official sources)? Why do you think that compressing the values will improve performance, 30k are not that many elements? – knittl Aug 02 '23 at 11:43
  • I have corrected my code. the value is a custom object. it has around 10 fields. Just thought to compress it so that it won't cause any memory issues later. – manjosh Aug 02 '23 at 15:07

0 Answers0