Package eu.europa.esig.dss.tsl.cache
Class AbstractCache<R extends CachedResult>
java.lang.Object
eu.europa.esig.dss.tsl.cache.AbstractCache<R>
- Type Parameters:
R- implementation ofCachedResultinterface
- Direct Known Subclasses:
DownloadCache,ParsingCache,ValidationCache
public abstract class AbstractCache<R extends CachedResult> extends Object
The abstract class containing basic methods for handling the
Result implementations-
Constructor Summary
Constructors Constructor Description AbstractCache() -
Method Summary
Modifier and Type Method Description Stringdump()voiderror(CacheKey cacheKey, Exception e)Updates entry status to ERROR valuevoidexpire(CacheKey cacheKey)Updates the state for a CachedEntry matching to the given key to EXPIREDCachedEntry<R>get(CacheKey cacheKey)Returns the CachedEntry for the relatedcacheKey.protected abstract CacheTypegetCacheType()Returns a type of current CacheSet<CacheKey>getKeys()Returns all current keysbooleanisDesync(CacheKey cacheKey)Checks if a CachedEntry for the given key is not up to datebooleanisEmpty(CacheKey cacheKey)Checks if a CachedEntry for the given key is empty (has no result)booleanisRefreshNeeded(CacheKey cacheKey)Checks if a CachedEntry for the given key is not up to datebooleanisToBeDeleted(CacheKey cacheKey)Checks if the requested cacheKey has TO_BE_DELETED valuevoidremove(CacheKey cacheKey)Removes the requested entry with the givencacheKeyvoidsync(CacheKey cacheKey)Updates the state for a CachedEntry matching to the given key to SYNCHRONIZEDvoidtoBeDeleted(CacheKey cacheKey)Updates entry status to TO_BE_DELETED valuevoidupdate(CacheKey cacheKey, R result)Updates in the cache the value forcacheKeywith the givenresult
-
Constructor Details
-
AbstractCache
public AbstractCache()
-
-
Method Details
-
getKeys
Returns all current keys- Returns:
- a set with all current keys
-
get
Returns the CachedEntry for the relatedcacheKey. Returns new empty entry if no result found for the key- Parameters:
cacheKey-CacheKey- Returns:
CachedEntry
-
update
Updates in the cache the value forcacheKeywith the givenresult- Parameters:
cacheKey-CacheKeykey to update value forresult-CachedResultto store
-
expire
Updates the state for a CachedEntry matching to the given key to EXPIRED- Parameters:
cacheKey-CacheKeyof a CachedEntry to update
-
remove
Removes the requested entry with the givencacheKey- Parameters:
cacheKey-CacheKeyof the entry to be deleted from the cache
-
sync
Updates the state for a CachedEntry matching to the given key to SYNCHRONIZED- Parameters:
cacheKey-CacheKeyof a CachedEntry to update
-
isRefreshNeeded
Checks if a CachedEntry for the given key is not up to date- Parameters:
cacheKey-CacheKeyof the CacheEntry to check- Returns:
- TRUE if update is required for the matching CachedKey, FALSE otherwise
-
isDesync
Checks if a CachedEntry for the given key is not up to date- Parameters:
cacheKey-CacheKeyof the CacheEntry to check- Returns:
- TRUE if update is required for the matching CachedKey, FALSE otherwise
-
isEmpty
Checks if a CachedEntry for the given key is empty (has no result)- Parameters:
cacheKey-CacheKeyof the CacheEntry to check- Returns:
- TRUE if the entry is empty, FALSE otherwise
-
error
Updates entry status to ERROR value -
toBeDeleted
Updates entry status to TO_BE_DELETED value- Parameters:
cacheKey-CacheKeyto update
-
isToBeDeleted
Checks if the requested cacheKey has TO_BE_DELETED value- Parameters:
cacheKey-CacheKeyto check- Returns:
- TRUE if the entry with the provided
cacheKeyhas TO_BE_DELETED status, FALSE otherwise
-
getCacheType
Returns a type of current Cache- Returns:
CacheType
-
dump
-