I am trying to implement a cache with a prefetch functionality.
The plan is that if the cache entry is new, then it will be returned as is. If the cache is older than a set age then the "old" cache will be returned while a new thread is spawned to refresh the entry. If it is even older than that it will update the entry and then return it.
The plan with this is to avoid having a cache miss where the user needs to wait for the cache to be refreshed.
I have sort of gotten a working model using a hashmap as a cache store, but this seems kind of dirty.
So I want to use the javax.cache.cache-api package for this and I chose org.infinispan.infinispan.jcache as an implementation.
The problem is that the objects I want to save in the cache is not serializable and I can't figure out how to make inifinispan allow them.
The reason for why they aren't serializable is because they store the functions to also update the cache entry.
Question is: Can you store non serializable objects like this with infinispan and if so, how?
Or is there any out of the box solution that already does what I am after?
Serializablethat contains the actual object. This obviously wont work if actual serialization takes place but that should only happen (in my eyes at least) if we're talking about a cache that is shared by multiple instances (if that's a thing with this package) - LotharSerializablebut with no luck. (and no it is not shared by multiple instances) - munHunger