Questions tagged [cache2k]

Questions regarding cache2k – Java Caching

cache2k – High Performance Java Caching

cache2k focuses on providing a well engineered in-memory object cache implementation for Java applications.

Site: https://cache2k.org/

Github: https://github.com/cache2k/cache2k

26 questions
6
votes
3 answers

Spring Boot test tries to initialize cache2k for the 2nd time and fails

After adding cache2k to my project some @SpringBootTest's stopped working with an error: java.lang.IllegalStateException: Cache already created: 'cache' Below I provide the minimal example to reproduce: Go to start.spring.io and create a simplest…
Kirill
  • 6,762
  • 4
  • 51
  • 81
3
votes
1 answer

Is cache2k a persistent cache?

I have used the cache2k in my java project and it was so simple (key-value pair) and easy to use. Now I want to know is if cache2k is a persistent or non-persistent cache. I found the answer in here https://stackoverflow.com/a/23709996/12605243…
Stack Kiddy
  • 556
  • 1
  • 4
  • 10
3
votes
1 answer

cache2k, read through and blocking

I have used cache2k with read through in a web application to load blog posts on demand. However, I am concerned about blocking for the read through feature. For example, if multiple threads (requests) ask the cache for the same key, is it…
user7352801
3
votes
1 answer

Does cache2k put() update the expiry time

I can't find an answer in the API docs, that's why I'd like to ask here: Given I have a cache2k cache import org.cache2k.Cache; import org.cache2k.CacheBuilder; import java.util.concurrent.TimeUnit; .... Cache cache = …
globalworming
  • 757
  • 1
  • 5
  • 33
2
votes
1 answer

cache2k: cache overflow to disk and cache limit by mem bytes

I am evaluating cache for my project. cache2k looks very promising. I went over the documentation, but could not find following items: can cache2k overflow to disk? can cache2k evict the entries (or overflow to disk) based on memory size (in…
bdhan
  • 21
  • 1
2
votes
1 answer

Is it possible to use Cache2k as hibernate second level cache and also as a spring cache manager?

I'm working with spring based application (not spring boot) and I'm trying to introduce cache2k as a spring cache manager. Currently cache2k is used as a Hibernate second level cache by setting the following…
Gavi
  • 1,300
  • 1
  • 19
  • 39
2
votes
1 answer

cache2k and Generic T do not play nice together

In the cache2k User Guide, §2.3. Cache Aside has a code sample and sentence about cache-aside. Cache routeToAirline = new Cache2kBuilder() {} .name("routeToAirline") .build(); private String…
granadaCoder
  • 26,328
  • 10
  • 113
  • 146
2
votes
1 answer

How to integrate Cache2k caching with Spring MVC 4?

I'm building a new Spring mvc project and I'm quite bit impressed to see the performance benchmark of Cache2K. Hoever, I couldn't find any article on how to configure it with the current Spring MVC 4.2.4 and Java 1.8 It'll be a great help if…
Abhinab Kanrar
  • 1,532
  • 2
  • 20
  • 46
1
vote
1 answer

Cache is not returning data after expiry even keepDataAfterExpired(true) is set

My Use case: I have to return the updated data from the cache every time without hitting the DB. So i have used RefreshAhead feature of Cache2K. Issue: I am facing few issues. I have kept expiry interval as 1 Minute, eternal = false and…
Ankit16
  • 13
  • 1
  • 4
1
vote
2 answers

Bypass cache while database update is in progress

I have configured cache2K with a loader so keys not present in the cache will be retrieved from the backend datastore. My pattern when updating persisted values it to update the database first, and then the cache is updated asynchronously through a…
aras03k
  • 11
  • 1
1
vote
2 answers

What is a proper way to use @CacheResult annotation with cache2k

I have JavaEE application and I'm trying to use cache2k with jCache to cache results of some functions. When I call methods annotated with @CacheResult nothing happens. I'm stuck and don't know what's wrong. I added these dependencies to my pom…
paxrex
  • 41
  • 1
  • 5
1
vote
1 answer

Reloading all cache2k entries at once

I would like to reload all cache entries in cache2k at once. I'm using version 1.2.2. I've tried to use org.cache2k.integration.CacheLoader#load method but it only accepts one key and returns one value. I don't like the idea to download only one…
1
vote
1 answer

How to access to the internal state of cache2k

I'm currently using the version 1.2.0.Final of cache2k. I want to persist the internal state of the cache so that my application can reuse the cache content after restarting. I've walked through the API of cache2k but I didn't find any possibility…
Minh Tuan Nguyen
  • 1,026
  • 8
  • 13
1
vote
1 answer

java.lang.NoClassDefFoundError when using cache2k on Android

cache2k looks awesome and I really want to use it in my app to cache objects, I'm getting a java.lang.NoClassDefFoundError: See my stack trace below: 12-02 19:09:43.421 25543-25543/uk.whitecrescent.waqti E/AndroidRuntime: FATAL EXCEPTION:…
Bassam Helal
  • 380
  • 3
  • 12
1
vote
1 answer

How to unit test a filter using cache2k

i am having a servlet filter which uses cache,the code basically goes like this public class CustomFilter implements Filter { private final Cache cache; @Autowired public CustomFilter(Service service){ cache =…
Parameswar
  • 1,951
  • 9
  • 34
  • 57
1
2