-
1. Re: JBCACHE-880 discussion ...
manik Nov 28, 2006 9:38 AM (in response to genman)Is this not a very specific use case though? Is this generic enough to be included in the distro, or should this be a customisation? I say we see how many votes it gets. Let's talk about it as a feature on the user forum and invite people to vote on the JIRA task.
How would your impl (if you've already checked it in, could you please revert this for now?) work with existing eviction policies? Can we, for example, have a LRU policy running alongside a policy that clears up expired nodes? -
2. Re: JBCACHE-880 discussion ...
genman Nov 28, 2006 7:05 PM (in response to genman)It's actually pretty common to want to cache values with a per node TTL.
Here are some references ...
http://ehcache.sourceforge.net/javadoc/net/sf/ehcache/Element.html#setTimeToIdle(int)
http://forums.tangosol.com/thread.jspa?threadID=1041&tstart=75
http://www.opensymphony.com/oscache/api/com/opensymphony/oscache/web/filter/ExpiresRefreshPolicy.html
I'm actually surprised this isn't supplied as a base expiration policy.
I actually registered on the Tangosol to get this Javadoc:com.tangosol.net Interface NamedCache put Object put(Object oKey, Object oValue, long cMillis) Associates the specified value with the specified key in this cache and allows to specify an expiry for the cache entry.
And you want to vote on it? -
3. Re: JBCACHE-880 discussion ...
manik Nov 29, 2006 8:54 AM (in response to genman)And there actually has been a thread on the user forum about this too, although I still think usage only makes sense for pretty specific cases.
About your implementation - how does this work with existing eviction policies? Also, why the use of an 'expiration' element, vs. a more explicit attribute on Node - Node.setTTL() or something?
And what are the semantics of this - millis since last accessed, millis since created, or expiry at a specific time? Perhaps this is best in the form of a pluggable policy too? -
4. Re: JBCACHE-880 discussion ...
genman Nov 29, 2006 1:34 PM (in response to genman)"manik.surtani@jboss.com" wrote:
And there actually has been a thread on the user forum about this too, although I still think usage only makes sense for pretty specific cases.
Web caching, session caching. JMS messages have expiration times. Almost every "business" object has some sort of lifespan or lifecycle.
Actually, I need it for my own specific application, and I don't see any better way. What's currently done is there's a timer that wakes up and scans a list of cached values and removes any ones past its expiration time.
Although it is fairly easy to implement as a plug-in, there's a lot of value of having it integrated and tested with the JBossCache product.
About your implementation - how does this work with existing eviction policies? Also, why the use of an 'expiration' element, vs. a more explicit attribute on Node - Node.setTTL() or something?
Adding an additional node element would require changing the interface for a fairly specific use case. It also increases the memory footprint of the Node.
And since this expiration value might need to be stored in a cache loader or replicated, it would also require changes to those areas.
setTTL() ultimately would likely have to call a series of interceptors, requiring more changes in TreeCache and everywhere ... I suppose it could simply translate into a "put()".
And what are the semantics of this - millis since last accessed, millis since created, or expiry at a specific time? Perhaps this is best in the form of a pluggable policy too?
Specific time is easier. TTL would be okay. But the question of replication comes up.
Perhaps I'm confusing eviction with removal? The specific time would be most useful as an indication for node removal, not for passivation.
Perhaps there should be a RemovalPolicy rather than EvictionPolicy?
Anyway, I'd appreciate you looking at the test cases.