public class FileCacheRaf
extends java.lang.Object
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.| Modifier and Type | Class and Description |
|---|---|
class |
FileCacheRaf.Raf |
| Constructor and Description |
|---|
FileCacheRaf(int minElementsInMemory,
int maxElementsInMemory,
int period) |
| Modifier and Type | Method and Description |
|---|---|
FileCacheRaf.Raf |
acquire(java.lang.String filename) |
void |
clearCache(boolean force) |
java.util.Collection |
getCache() |
void |
release(FileCacheRaf.Raf craf) |
static void |
shutdown() |
public FileCacheRaf(int minElementsInMemory,
int maxElementsInMemory,
int period)
public void clearCache(boolean force)
public java.util.Collection getCache()
public static void shutdown()
public FileCacheRaf.Raf acquire(java.lang.String filename) throws java.io.IOException
java.io.IOExceptionpublic void release(FileCacheRaf.Raf craf) throws java.io.IOException
java.io.IOException