I wanted to create my own eviction policy where the time to live would be determined by an attribute of the object. I am currently using the FIFOPolicy. It looks like I could extend that and override the getEvictionAlgorithm method to return a custom Policy inheriting from the LRUAlgorithm. Then I could override the evict method and decide if I really wanted to evict the node or not.
One of the problems I'm seeing though has to do with the prune method. I wouldn't want to overide the eviction of nodes when the eviction is occuring because of the number of items (I don't want to run out of memory). But I would want to override the pruning items based on age. The way I was looking to do this seems like a hack. Is there a better way to do this? To give some perspective: I have items in a cache representing the price of an item. The prices of these items may change at any time. The source of the price comes from an SAP backend. One of the attributes on the priced item is a field indicating the relevancy of the item saying how well the item has sold in the last few months. Items which are sold more frequently should expire in the cache faster than items that don't sell as frequently. Before, I started looking at implementing a custom eviction policy, I was wrapping access to the data in a DAO pattern, after pulling the item out of the cache I was examing the field and checking the retieval time of the item manually. If it was too old, I would get the item directly from the SAP backend. Thanks. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3875178#3875178 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3875178 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jboss-user
