ucar.nc2.util.cache
Class FileCacheRaf
java.lang.Object
ucar.nc2.util.cache.FileCacheRaf
public class FileCacheRaf
- extends Object
Keep cache of open RandomAccessFile, for performance.
Used by TDS to optimize serving netCDF files over HTTP.
RandomAccessFile raf = null;
try {
RandomAccessFile raf = FileCache.acquire(location, cancelTask);
...
} finally {
FileCache.release( raf)
}
Library ships with cache disabled.
If you want to use, call init() and make sure you call exit() when exiting program.
All methods are thread safe.
Cleanup is done automatically in a background thread, using LRU.
- Author:
- jcaron
Constructor Summary |
FileCacheRaf(int minElementsInMemory,
int maxElementsInMemory,
int period)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileCacheRaf
public FileCacheRaf(int minElementsInMemory,
int maxElementsInMemory,
int period)
clearCache
public void clearCache(boolean force)
getCache
public Collection getCache()
shutdown
public static void shutdown()
acquire
public FileCacheRaf.Raf acquire(String filename)
throws IOException
- Throws:
IOException
release
public void release(FileCacheRaf.Raf craf)
throws IOException
- Throws:
IOException
Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.