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
The abstract class containing basic methods for handling the
Result implementations-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor instantiating cache with empty map -
Method Summary
Modifier and TypeMethodDescriptiondump()Produces a report of the current cache statevoidUpdates entry status to ERROR valuevoidUpdates the state for a CachedEntry matching to the given key to EXPIREDReturns the CachedEntry for the relatedcacheKey.protected abstract CacheTypeReturns a type of current CachegetKeys()Returns all current keysbooleanChecks if a CachedEntry for the given key is not up to datebooleanChecks 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 valuevoidRemoves the requested entry with the givencacheKeyvoidUpdates the state for a CachedEntry matching to the given key to SYNCHRONIZEDvoidtoBeDeleted(CacheKey cacheKey) Updates entry status to TO_BE_DELETED valuevoidUpdates in the cache the value forcacheKeywith the givenresult
-
Constructor Details
-
AbstractCache
protected AbstractCache()Default constructor instantiating cache with empty map
-
-
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
Produces a report of the current cache state- Returns:
Stringthe cache report
-