2 Replies Latest reply on Feb 17, 2005 9:13 AM by belaban

    Forcing eviction of child nodes

      Hi;

      In section 8.1 of the TreeCache documentation (and related docs/design/EvictionPolicy.txt), it says that when a node is evicted, it will only be removed if it does not have children.

      I understand why this is desirable in some cases, but I have a slightly different requirement.

      In my case, if a node is ready to be evicted, all of its children must be evicted at the same time. Basically, I want the whole family of the Fqn in question to be evicted at the same time.

      After digging through the code a bit, I see that BaseEvictionPolicy is calling TreeCache._evict(Fqn) which in turn is checking to see if the evicted node has children, and if so, it only removes the data by calling _removeData().

      Now to the questions.

      1. Are there any plans in the roadmap to support the kind of forceful eviction policy I need in JBoss Cache?
      2. Are there any side effects with me implementing a new LRUPolicy that forcefully evicts a node and its children?
      3. Any advice on how to do #2? Off the top of my head I would probably create a new CascadingLRUPolicy class that overrides the evict(Fqn) method to accomplish what I need to do. The new evict() implementation would be largely a copy/paste of TreeCache._evict() but thatt doesn't check for children. Here's a quick mock-up of what the new CascadingLRUPolicy.evict(Fqn) implemention might look like:

      public void _evict(Fqn fqn) throws Exception {

      if(!cache_.exists(fqn)) return; // node does not exist. Maybe it has been recursively removed.
      // use remove method now if there is a child node. Otherwise, it is removed
      boolean create_undo_ops = false;
      boolean sendNodeEvent = false;
      boolean eviction=true;
      _remove(null, fqn, create_undo_ops, sendNodeEvent, eviction);
      }


      Thanks in advance for any/all help.

      Regards,

      Brian Dueck