public class FileLFUCache
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected LFUCache<java.io.File,byte[]> |
cache |
protected int |
maxFileSize |
protected int |
maxSize |
protected int |
usedSize |
| Constructor and Description |
|---|
FileLFUCache(int maxSize)
Creates file LFU cache with specified size.
|
FileLFUCache(int maxSize,
int maxFileSize) |
FileLFUCache(int maxSize,
int maxFileSize,
long timeout)
Creates new File LFU cache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the cache.
|
int |
getCachedFilesCount()
Returns number of cached files.
|
long |
getCacheTimeout()
Returns timeout.
|
byte[] |
getFileBytes(java.io.File file)
Returns cached file bytes.
|
byte[] |
getFileBytes(java.lang.String fileName) |
int |
getMaxFileSize()
Returns maximum allowed file size that can be added to the cache.
|
int |
getMaxSize()
Returns max cache size in bytes.
|
int |
getUsedSize()
Returns actually used size in bytes.
|
protected final LFUCache<java.io.File,byte[]> cache
protected final int maxSize
protected final int maxFileSize
protected int usedSize
public FileLFUCache(int maxSize)
max available file size to half of this value.public FileLFUCache(int maxSize,
int maxFileSize)
public FileLFUCache(int maxSize,
int maxFileSize,
long timeout)
maxSize - total cache size in bytesmaxFileSize - max available file size in bytes, may be 0timeout - timeout, may be 0public int getMaxSize()
public int getUsedSize()
public int getMaxFileSize()
public int getCachedFilesCount()
public long getCacheTimeout()
public void clear()
public byte[] getFileBytes(java.lang.String fileName)
throws java.io.IOException
java.io.IOExceptionpublic byte[] getFileBytes(java.io.File file)
throws java.io.IOException
java.io.IOExceptionCopyright © 2003-2013 Jodd Team