Questions tagged [cache2k]
Questions regarding cache2k – Java Caching
26
questions
0
votes
0
answers
28
views
how to use cache2k with xml configuration in springboot?
I wanted to use cache2k with xml configuration in my spring boot project but not able to do by seeing documention of cache2k.can anybody please help me with this.no enough info available in ...
1
vote
1
answer
289
views
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 ...
0
votes
1
answer
1k
views
Multiple tests with @SpringBootTest fail during Maven build in Spring Cache project with Cache2K
I have a Spring Boot REST project with multiple @SpringBootTest JUnit test cases.
The project uses Spring Cache with Cache2K. There is a factory bean that creates a CacheManager with a cache.
@Bean
...
0
votes
1
answer
454
views
Cache2K auto refreshAhead does'nt work as expected
I'm trying to create cache with auto refreshing elements using org.cache2k library.
For example I define element loader with duration of 5 seconds.
I set expire time 5 seconds. And I set ...
1
vote
2
answers
85
views
Bypass cache while database update is in progress [closed]
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 ...
2
votes
1
answer
235
views
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 ...
3
votes
1
answer
347
views
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
...
1
vote
2
answers
3k
views
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 ...
1
vote
1
answer
457
views
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 ...
6
votes
3
answers
2k
views
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 ...
1
vote
1
answer
89
views
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 ...
2
votes
1
answer
400
views
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 ...
1
vote
1
answer
1k
views
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....
1
vote
1
answer
298
views
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<String, ClientRequest> cache;
@...
2
votes
1
answer
753
views
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<String, String> routeToAirline = new Cache2kBuilder<String, String>() {}
.name("...
1
vote
1
answer
606
views
how to integrate cache2k with hibernate
How i can integrate cache2k like hibernate cache provider?
I mean in current project we use ehcache and
enable cache in next configuration hibernate.cfg.xml :
<hibernate-configuration>
&...
1
vote
0
answers
272
views
In cache2k, how does one add a new Cache implementation or can a cache be disabled temporarily?
I am trying to temporarily disable (by disable I mean: act as if caching was turned off entirely) a set of cache2k caches and there seems to be no way to do this with the default implementation at "...
1
vote
1
answer
603
views
How to set expiry while put() using cache2k
I want something like redis set and ttl, such as
public void put(K key, V value, int timeToLive, TimeUnit timeUnit);
public long ttl(K key);
and one more operation that redis doesn't provide
public ...
3
votes
1
answer
1k
views
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 (...
1
vote
1
answer
453
views
Cache2k: java.lang.UnsupportedOperationException: loader not set
Cache2k looks like a very promising caching implementation. Unfortunately the documentation is very limited, which is why I need some help with the following issue. I am using the latest version 0.26-...
1
vote
1
answer
1k
views
Proper usage of cache.putIfAbsent() in Cache2k
I am wondering how to work with the putIfAbsent() method when using the Cache2k cache. In the ConcurrentHashMap for example, one works with the method like this:
Set<X> set = map.get(name);
if (...
0
votes
1
answer
46
views
equal keys trigger cache load more than expected
Maybe I am totally misguided on how cache2k works. I want to cache results from very costly operations, but even with equal keys, the results are always generated again. First I thought, the keys ...
0
votes
1
answer
731
views
How to define persistence storage in cache2k?
It is said in Cache apidoc, that several methods like purge() or flush() operates dependent on persistence storage configured.
Unfortunately, I can't find, how to configure one?
Is it really ...
2
votes
1
answer
876
views
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....
3
votes
1
answer
801
views
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;
...
1
vote
1
answer
321
views
cache2k cachesource working with mysql as backend
i am using cache2k as cache for my java application.
I use a CacheSource for get and peek requests if a cache is not in the in-mermoy cache.
But now i want to implement the put method.
How can i ...