src/main/java/org/jboss/util/TimedCachePolicy.java
public Object get(Object key) 
   {
      TimedEntry entry = (TimedEntry) entryMap.get(key);
      if( entry == null )
         return null;

      if( entry.isCurrent(now) == false )
      {   // Try to refresh the entry
         if( entry.refresh() == false )
         {   // Failed, remove the entry and return null
            entry.destroy();
            entryMap.remove(key);
            return null;
         }
      }
      Object value = entry.getValue();
      return value;
   }
public Object get(Object key) 
   {
      TimedEntry entry = (TimedEntry) entryMap.get(key);
      if( entry == null )
         return null;

      if( entry.isCurrent(now) == false )
      {   // Try to refresh the entry
         if( entry.refresh() == false )
         {   // Failed, remove the entry and return null
            entry.destroy();
            entryMap.remove(key);
            return null;
         }
      }
      Object value = entry.getValue();
      return value;
   }
public Object get ( Object key ) { TimedEntry entry = ( TimedEntry ) entryMap . get ( key ) ; if ( entry == null ) return null ; if ( entry . isCurrent ( now ) == false ) { // Try to refresh the entry if ( entry . refresh ( ) == false ) { // Failed, remove the entry and return null entry . destroy ( ) ; entryMap . remove ( key ) ; return null ; } } Object value = entry . getValue ( ) ; return value ; }
Get the cache value for key if it has not expired. If the TimedEntry
is expired its destroy method is called and then removed from the cache.
@return the TimedEntry value or the original value if it was not an
instance of TimedEntry if key is in the cache, null otherwise.
Get the cache value for key if it has not expired . If the TimedEntry is expired its destroy method is called and then removed from the cache .