|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.ephyra.util.FileCache
public class FileCache
The FileCache is a simple implementation of a permanent
cache. The entries of the cache are accessed by keys. Both keys and entries
are strings, and there may be an arbitrary number of entries for a key.
The entries are stored in files in a directory which is specified when the cache handler is created. There is one file for each key and the MD5 checksum of the key is used as the filename.
| Field Summary | |
|---|---|
private java.lang.String |
cacheDir
The directory where the files are stored. |
| Constructor Summary | |
|---|---|
FileCache(java.lang.String cacheDir)
Creates a new cache handler and sets the directory of the cache. |
|
| Method Summary | |
|---|---|
private java.lang.String |
getMD5(java.lang.String s)
Computes the MD5 checksum of a string. |
java.lang.String[] |
read(java.lang.String key)
Read the entries for the given key from the cache. |
boolean |
write(java.lang.String key,
java.lang.String[] entries)
Writes new entries to the cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String cacheDir
| Constructor Detail |
|---|
public FileCache(java.lang.String cacheDir)
cacheDir - cache directory| Method Detail |
|---|
private java.lang.String getMD5(java.lang.String s)
s - the string
null if the MD5 algorithm is not
availablepublic java.lang.String[] read(java.lang.String key)
key - the key
null if the key is not in the cache
public boolean write(java.lang.String key,
java.lang.String[] entries)
key - the keyentries - the entries
true iff the entries could be written to the cache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||