PDA

View Full Version : Using Jcache with resin 4.0.5


thorr09
04-02-2010, 12:27 PM
Hi!
I am trying to use resin's distributed caching. I found this link http://blog.caucho.com/?p=132 which presents a sample code to exactly what I would like to implement. The problem is that I can not reuse that code exactly as is there, because for example I cannot find anywhere the package javax.webbeans.Current. So I can not use the annotation @Current. Anyway, I tried to use another solution in this sense: the @Inject annotation which is present hin this package: javax.inject.Inject. I created a web application, put in WEB-INF the resin-web.xml with the data showed on the site and created a servlet which should put a value into the cache and then read it from there. Everything was successful to this point. Now I tried to delete all the data which I have put in the cache using _cache.clear() command. Although _cache.containsKey("my-data") returns 0 the cache.get("my-data") keeps returning my initial data. I have even deleted everything from my servlet letting only the clear and get command there and it still returns data. It seems once put in the cache it can not be deleted from there? Please help me out with this issue...

Thanks,

nam
04-03-2010, 02:49 AM
Looking through the source code, it appears that the backing store does not keep track of the keys that are inserted into it. That means that a clear() will only delete entries in the local store. A remove() should delete entries in both the local and backing store.

yfhsu
11-17-2011, 05:28 PM
Hi,

We are exploring JCache in Resin 4.0.23. Where can I find out more documentation on JCache configuration and implementation details? For example,
1. What are the valid configuration parameters, write-through, read-through, transaction level, size of the cache? Is everything on the spec supported?
2. What's the underlying storage? If it's memcached, what version is it?
3. From our last meeting with Rick/Teresa, the cache is replicated within the try-ad servers. would the total size of the cache increase as each server were added to the cluster? In other words, does it support consistent hashing?
4. Is listener supported ?

Regards,
Yen-Fen

ferg
11-22-2011, 07:05 PM
jCache is a bit tricky at the moment because the spec is in active development and is changing rapidly. Basically, every Resin release, the jCache has changed.

Currently, we're focusing on the pieces that seem to be stabilized, which are the basic get(), and put(), and remove() and also the compare-and-set equivalents like putIfAbsent(), and replace().

We are not doing transactions at this time, because we're focusing on a simpler memcache-like model, which is more appropriate for a majority of cache uses.

The timeout parameters, etc. are in the <ClusterCache> configuration when you create a cache or the <MemcacheCache> if you're using memcache as a backing.

The read/write through have not been implemented, although they're easy.

The listener is more complicated. A local (same JVM) listener is easy. The remove listener is trickier, because it's essentially equivalent to a pub/sub system. We have the infrastructure for it, but it is more complicated.

The total size of the cache is stored on each triad server as disk data. So the limitation is the size of your hard drive. It's not related to the physical memory at all. Multiple gigs or even hundreds of gigs are straightforward.

Currently, we don't have a cache size limit, under the assumption that disk space is essentially infinite.

Hashing is a bit different in Resin's case because it's used primarily for load balancing and locking/consistency. All the triad servers get all copies of the data. The hashed owner gets the data first for sync/locking reasons. Essentially, you want to think of Resin's store as a single hub, that internally is triple replicated, but acts as a unit.