4 Replies Latest reply on Jan 24, 2011 6:17 AM by Mircea Markus

    Cache.put with Timespan doesnt evicy teh cache entry.

    Sudheer Krishna Novice

      I  and testing teh cache fucntionalities of which i am trying to add an entry which shoudl be cleared up after teh given time span. This doesnt seem to work. Have i misunderstood teh API ?

       

      The code lools as follows which i am calling in a loop

       

              Cache cache = manager.getCache("orderCache");

              cache.put(key, value, 3L, TimeUnit.MILLISECONDS);

              System.out.println("size" + cache.size());

       

      The  size of  cache is same as loop interation . Shouldnt the entry be cleared ?

       

      My cache configuration is as follows

       

       

             <namedCache name="orderCache">

                    <clustering mode="distribution">

                        <sync/>

                        <hash

                           numOwners="2"

                           rehashWait="120000"

                           rehashRpcTimeout="600000"

                        />

                     </clustering>

               </namedCache>