ucar.nc2.util.cache
Class FileCacheRaf
java.lang.Object
ucar.nc2.util.cache.FileCacheRaf
public class FileCacheRaf
- extends java.lang.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 java.util.Collection getCache()
shutdown
public static void shutdown()
acquire
public FileCacheRaf.Raf acquire(java.lang.String filename)
throws java.io.IOException
- Throws:
java.io.IOException
release
public void release(FileCacheRaf.Raf craf)
throws java.io.IOException
- Throws:
java.io.IOException