Questions tagged [cache2k]

Questions regarding cache2k – Java Caching

Filter by
Sorted by
Tagged with
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 ...
sudhanshu_agariya's user avatar
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 ...
Ankit16's user avatar
  • 13
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 ...
Shankar's user avatar
  • 2,677
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 ...
Sergey Afinogenov's user avatar
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 ...
aras03k's user avatar
  • 11
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 ...
bdhan's user avatar
  • 21
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 ...
Stack Kiddy's user avatar
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 ...
paxrex's user avatar
  • 41
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 ...
ppiatkowski's user avatar
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 ...
Kirill's user avatar
  • 6,944
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 ...
Minh Tuan Nguyen's user avatar
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 ...
Gavi's user avatar
  • 1,330
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....
Bassam Helal's user avatar
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; @...
Parameswar's user avatar
  • 1,981
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("...
granadaCoder's user avatar
  • 26.6k
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> &...
Nolik's user avatar
  • 141
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 "...
DavidT's user avatar
  • 356
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 ...
quaff's user avatar
  • 51
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 (...
user avatar
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-...
michaeldd's user avatar
  • 514
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 (...
michaeldd's user avatar
  • 514
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 ...
globalworming's user avatar
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 ...
Dims's user avatar
  • 48.4k
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....
Abhinab Kanrar's user avatar
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; ...
globalworming's user avatar
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 ...
pila's user avatar
  • 928