|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.cocoon.cache.LRUCache
A class to encapsulate the caching of preprocessed XML files.
Field Summary | |
private java.util.Hashtable |
cache
|
private java.lang.String |
directory
|
private int |
maxDiskObjects
|
private int |
maxMemObjects
|
Constructor Summary | |
LRUCache()
|
Method Summary | |
boolean |
containsKey(java.lang.Object key)
Check if the specified key exists in this Cache. |
private boolean |
containsKeyOnDisk(java.lang.Object key)
Check if the specified key exists in cache on disk. |
java.lang.Object |
get(java.lang.Object key)
Get a value from the cache for the specified key Object. |
private java.lang.Object |
getFromDisk(java.lang.Object key)
Get a cached Object from disk for the specified key. |
int |
getMaxDiskSize()
Get the maximum number of objects this cache can hold on disk. |
int |
getMaxMemSize()
Get the maximum number of objects this cache can hold in memory. |
int |
getSize()
Get the number of objects currently in cache. |
private int |
getSizeOnDisk()
Get the number of cached objects on disk for this cache. |
void |
init(Configurations conf)
Initialize this cache using the configuration information. |
void |
put(java.lang.Object key,
java.lang.Object value)
Put a key/value pair in the cache. |
private void |
putLRUToDisk()
Put the least recently used cache pair to disk. |
private void |
putToDisk(java.lang.Object key)
Put the object with the specified key to the disk cache. |
java.lang.String |
toString()
Return a textual identifier for this cache. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.util.Hashtable cache
private int maxMemObjects
private int maxDiskObjects
private java.lang.String directory
Constructor Detail |
public LRUCache()
Method Detail |
public void init(Configurations conf)
conf
- the configuration informationpublic void put(java.lang.Object key, java.lang.Object value)
key
- the key Object of the key/value pairvalue
- the value Object of the key/value pairpublic java.lang.Object get(java.lang.Object key)
key
- the key Objectpublic boolean containsKey(java.lang.Object key)
key
- the key to check forpublic int getSize()
public int getMaxMemSize()
public int getMaxDiskSize()
private void putLRUToDisk()
private void putToDisk(java.lang.Object key)
key
- the key of the object to cache to diskprivate java.lang.Object getFromDisk(java.lang.Object key)
key
- the key Objectprivate boolean containsKeyOnDisk(java.lang.Object key)
key
- the key to check forprivate int getSizeOnDisk()
public java.lang.String toString()
|
Copyright (c) 1998 The Java Apache Project | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |