|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjodd.cache.FileLFUCache
public class FileLFUCache
Files LFU cache stores files content in memory to dramatically speed up performances for frequently read files.
| Field Summary | |
|---|---|
protected LFUCache<java.io.File,byte[]> |
cache
|
protected int |
maxFileSize
|
protected int |
maxSize
|
protected int |
usedSize
|
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final LFUCache<java.io.File,byte[]> cache
protected final int maxSize
protected final int maxFileSize
protected int usedSize
| Constructor Detail |
|---|
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 0| Method Detail |
|---|
public 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.IOException
public byte[] getFileBytes(java.io.File file)
throws java.io.IOException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||