public class CacheLRUWrapper
extends java.lang.Object
Constructor and Description |
---|
CacheLRUWrapper() |
Modifier and Type | Method and Description |
---|---|
boolean |
addEntry(java.lang.String key,
java.lang.String path)
This adds a new entry to file.
|
boolean |
containsKey(java.lang.String key) |
boolean |
containsValue(java.lang.String value) |
java.lang.String |
generateKey(java.lang.String path)
Generate a key given the path to file.
|
InfrastructureFileDescriptor |
getCacheDir() |
static CacheLRUWrapper |
getInstance()
Returns an instance of the policy.
|
java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> |
getLRUSortedEntries()
Return a copy of the keys available.
|
InfrastructureFileDescriptor |
getRecentlyUsedFile() |
java.lang.String |
getValue(java.lang.String key)
Return the value of given key.
|
java.io.File |
getWindowsShortcutList() |
void |
load()
Update map for keeping track of recently used items.
|
void |
lock()
Lock the file to have exclusive access.
|
boolean |
removeEntry(java.lang.String key)
This removed an entry from our map.
|
boolean |
store()
Write file to disk.
|
void |
unlock()
Unlock the file.
|
boolean |
updateEntry(java.lang.String oldKey)
This updates the given key to reflect it was recently accessed.
|
public static CacheLRUWrapper getInstance()
public InfrastructureFileDescriptor getCacheDir()
public java.io.File getWindowsShortcutList()
public InfrastructureFileDescriptor getRecentlyUsedFile()
public void load()
public boolean store()
public boolean addEntry(java.lang.String key, java.lang.String path)
key
- key we want path to be associated with.path
- path to cache item.public boolean removeEntry(java.lang.String key)
key
- key we want to remove.public boolean updateEntry(java.lang.String oldKey)
oldKey
- Key we wish to update.public java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> getLRUSortedEntries()
public void lock()
public void unlock()
public java.lang.String getValue(java.lang.String key)
key
- key of propertypublic boolean containsKey(java.lang.String key)
public boolean containsValue(java.lang.String value)
public java.lang.String generateKey(java.lang.String path)
path
- Path to generate a key with.