Package net.sourceforge.jnlp.cache
Class CacheLRUWrapper
java.lang.Object
net.sourceforge.jnlp.cache.CacheLRUWrapper
This class helps maintain the ordering of most recently use items across
multiple jvm instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
This adds a new entry to file.boolean
containsKey
(String key) boolean
containsValue
(String value) generateKey
(String path) Generate a key given the path to file.static CacheLRUWrapper
Returns an instance of the policy.Return a copy of the keys available.Return the value of given key.void
load()
Update map for keeping track of recently used items.void
lock()
Lock the file to have exclusive access.boolean
removeEntry
(String key) This removed an entry from our map.boolean
store()
Write file to disk.void
unlock()
Unlock the file.boolean
updateEntry
(String oldKey) This updates the given key to reflect it was recently accessed.
-
Constructor Details
-
CacheLRUWrapper
public CacheLRUWrapper()
-
-
Method Details
-
getInstance
Returns an instance of the policy.- Returns:
- an instance of the policy
-
getCacheDir
- Returns:
- the cacheDir
-
getWindowsShortcutList
-
getRecentlyUsedFile
- Returns:
- the recentlyUsedFile
-
load
public void load()Update map for keeping track of recently used items. -
store
public boolean store()Write file to disk.- Returns:
- true if properties were successfully stored, false otherwise
-
addEntry
This adds a new entry to file.- Parameters:
key
- key we want path to be associated with.path
- path to cache item.- Returns:
- true if we successfully added to map, false otherwise.
-
removeEntry
This removed an entry from our map.- Parameters:
key
- key we want to remove.- Returns:
- true if we successfully removed key from map, false otherwise.
-
updateEntry
This updates the given key to reflect it was recently accessed.- Parameters:
oldKey
- Key we wish to update.- Returns:
- true if we successfully updated value, false otherwise.
-
getLRUSortedEntries
Return a copy of the keys available.- Returns:
- List of Strings sorted by ascending order.
-
lock
public void lock()Lock the file to have exclusive access. -
unlock
public void unlock()Unlock the file. -
getValue
Return the value of given key.- Parameters:
key
- key of property- Returns:
- value of given key, null otherwise.
-
containsKey
-
containsValue
-
generateKey
Generate a key given the path to file. May or may not generate the same key given same path.- Parameters:
path
- Path to generate a key with.- Returns:
- String representing the a key.
-