1 Reply Latest reply on Jul 16, 2005 1:54 AM by Bela Ban

    Is it possible to enumerate ALL of the object in the cache?

    gregorypierce Newbie

      Experimentation with TreeCache shows that the only thing getKeys returns is the object/objects at that level in the tree.

      So if I have objects at


      and ask for path /foo I will get two objects. If I ask for "/" or "" I get no objects at all. Is there no way to get the keys for everything in the cache so that I can iterate over all of it?

       public static void main( String[] args )
       TreeCache cache = new TreeCache();
       cache.put("/foo", "foo", new Rectangle() );
       cache.put("/foo", "bar", "Something Else" );
       cache.put("/foo/bar", "barchild", "Child of bar");
       Set children = cache.getChildrenNames("/");
       Set keys = cache.getKeys("/");
       logger.debug("Cache contains ["+ cache.getNumberOfNodes() + "] nodes");
       logger.debug("Children of / are " + children.size() + "[" + children + "]" );
       logger.debug("Cache members are " + cache.getMembers().size() );
       logger.debug("" + keys.size() );
       catch( Exception e )
       logger.error("Something bad happened", e);

      Is there nothing I can do except attempt to walk the cache tree myself?