Package overit.geocall.cache
Class Cached<T>
java.lang.Object
overit.geocall.cache.Cached<T>
- Type Parameters:
T- type of the cached element
- All Implemented Interfaces:
Serializable
Wrapper class that holds references to an element in the
Cache.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear this cache in order to force reloading on the next getget()Get the cached element.getEntry()Get the entry that identifies this cached element within theCache.voidInvalidate the cache's item.booleanisValid()Check if the cached object is still valid or must be reloaded from the cache
-
Constructor Details
-
Method Details
-
get
Get the cached element. If the element has not been extracted yet or if it has been invalidated, the element will be re-loaded from scratch from the cache- Returns:
- the cached element
-
getEntry
Get the entry that identifies this cached element within theCache.- Returns:
- the
Entryinstance used to identify the cached item
-
invalidate
public void invalidate()Invalidate the cache's item. This force the re-load the next time theget()method will be called -
clear
public void clear()Clear this cache in order to force reloading on the next get -
isValid
public boolean isValid()Check if the cached object is still valid or must be reloaded from the cache- Returns:
trueif the cached element is still valid,falseotherwise
-