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 ofCachedResult
interface
- Direct Known Subclasses:
DownloadCache
,ParsingCache
,ValidationCache
The abstract class containing basic methods for handling the
Result
implementations-
Constructor Summary
ModifierConstructorDescriptionprotected
Default constructor instantiating cache with empty map -
Method Summary
Modifier and TypeMethodDescriptiondump()
Produces a report of the current cache statevoid
Updates entry status to ERROR valuevoid
Updates the state for a CachedEntry matching to the given key to EXPIREDReturns the CachedEntry for the relatedcacheKey
.protected abstract CacheType
Returns a type of current CachegetKeys()
Returns all current keysboolean
Checks if a CachedEntry for the given key is not up to dateboolean
Checks if a CachedEntry for the given key is empty (has no result)boolean
isRefreshNeeded
(CacheKey cacheKey) Checks if a CachedEntry for the given key is not up to dateboolean
isToBeDeleted
(CacheKey cacheKey) Checks if the requested cacheKey has TO_BE_DELETED valuevoid
Removes the requested entry with the givencacheKey
void
Updates the state for a CachedEntry matching to the given key to SYNCHRONIZEDvoid
toBeDeleted
(CacheKey cacheKey) Updates entry status to TO_BE_DELETED valuevoid
Updates in the cache the value forcacheKey
with 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 forcacheKey
with the givenresult
- Parameters:
cacheKey
-CacheKey
key to update value forresult
-CachedResult
to store
-
expire
Updates the state for a CachedEntry matching to the given key to EXPIRED- Parameters:
cacheKey
-CacheKey
of a CachedEntry to update
-
remove
Removes the requested entry with the givencacheKey
- Parameters:
cacheKey
-CacheKey
of the entry to be deleted from the cache
-
sync
Updates the state for a CachedEntry matching to the given key to SYNCHRONIZED- Parameters:
cacheKey
-CacheKey
of a CachedEntry to update
-
isRefreshNeeded
Checks if a CachedEntry for the given key is not up to date- Parameters:
cacheKey
-CacheKey
of 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
-CacheKey
of 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
-CacheKey
of 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
-CacheKey
to update
-
isToBeDeleted
Checks if the requested cacheKey has TO_BE_DELETED value- Parameters:
cacheKey
-CacheKey
to check- Returns:
- TRUE if the entry with the provided
cacheKey
has 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:
String
the cache report
-