I came with a new Eviction strategy. The idea is to allow users to "put" an
expiration time into a Node, and the cache will then evict the node at that time.
I went ahead and commited the changes already, but I'm not 100% pleased yet.
The things that I am not happy with are:
1. I used "Long(timestamp)" as the expiration time. It would make more sense ot
have expiration indicated with a java.util.Date instead, except Date is a (little) heavier
and not constant.
2. Most of the time, users want to use a relative time, e.g. 10 seconds or 10 days.
3. Expiration is indicated with a String field "expiration". (Although it's
configurable, I don't see why people would want to change this.) Getting this string
constant out results in code that looks kind of crappy.
Ideally, it would be better to have an API, such as:
Node.setTimeToLive(int amount, TimeUnit unit);
If this were Ruby, I'd add this method to the object at runtime. :-)
Anyway, perhaps this belongs in a Util class or a static method on some existing class?
Thoughts?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989165#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...