cdm/src/main/java/ucar/nc2/util/cache/FileCache.java
@Override
  public void eject(Object hashKey) {
     if (disabled.get()) return;

     // see if its in the cache
     CacheElement wantCacheElem = cache.get(hashKey);
     if (wantCacheElem == null) return;

     synchronized (wantCacheElem) { // synch in order to traverse the list
       for (CacheElement.CacheFile want : wantCacheElem.list) {
          // LOOK can we use remove(want);  ??
          files.remove(want.ncfile);
          try {
            want.ncfile.setFileCache(null); // unhook the caching
            want.ncfile.close();  // really close the file
            log.debug("close "+want.ncfile.getLocation());
          } catch (IOException e) {
            log.error("close failed on "+want.ncfile.getLocation(), e);
          }
          want.ncfile = null;
         if (debugPrint) System.out.println("  FileCache " + name + " eject " + hashKey);
       }
       wantCacheElem.list.clear();
     }
    cache.remove(hashKey);
   }
@Override
  public void eject(Object hashKey) {
     if (disabled.get()) return;

     // see if its in the cache
     CacheElement wantCacheElem = cache.get(hashKey);
     if (wantCacheElem == null) return;

     synchronized (wantCacheElem) { // synch in order to traverse the list
       for (CacheElement.CacheFile want : wantCacheElem.list) {
          // LOOK can we use remove(want);  ??
          files.remove(want.ncfile);
          try {
            want.ncfile.setFileCache(null); // unhook the caching
            want.ncfile.close();  // really close the file
            log.debug("close "+want.ncfile.getLocation());
          } catch (IOException e) {
            log.error("close failed on "+want.ncfile.getLocation(), e);
          }
          want.ncfile = null;
         if (debugPrint) System.out.println("  FileCache " + name + " eject " + hashKey);
       }
       wantCacheElem.list.clear();
     }
    cache.remove(hashKey);
   }
@ Override public void eject ( Object hashKey ) { if ( disabled . get ( ) ) return ; // see if its in the cache
 CacheElement wantCacheElem = cache . get ( hashKey ) ; if ( wantCacheElem == null ) return ; synchronized ( wantCacheElem ) { // synch in order to traverse the list
 for ( CacheElement . CacheFile want : wantCacheElem . list ) { // LOOK can we use remove(want);  ??
 files . remove ( want . ncfile ) ; try { want . ncfile . setFileCache ( null ) ; // unhook the caching
 want . ncfile . close ( ) ; // really close the file
 log . debug ( "close " + want . ncfile . getLocation ( ) ) ; } catch ( IOException e ) { log . error ( "close failed on " + want . ncfile . getLocation ( ) , e ) ; } want . ncfile = null ; if ( debugPrint ) System . out . println ( "  FileCache " + name + " eject " + hashKey ) ; } wantCacheElem . list . clear ( ) ; } cache . remove ( hashKey ) ; }
Remove all instances of object from the cache
@param hashKey the object
Remove all instances of object from the cache