Interface CacheContext
- All Known Implementing Classes:
CurrentCacheContext
public interface CacheContext
Contains information for a Cache entry
-
Method Summary
Modifier and TypeMethodDescriptionvoid
desync()
Set the context as DESYNCHRONIZEDvoid
error
(CachedExceptionWrapper exception) Store the exception for its occurrence timevoid
errorUpdateDate
(CachedExceptionWrapper updatedException) Store the last occurrence of this exceptionReturns the current state in the cacheReturns the met exceptionReturns the date of the last state transitionReturns the last time when the cache has been synchronized successfully NOTE: can be null in case if the cache has never been synchronizedboolean
isDesync()
Returns TRUE if the cache is in DESYNC statusboolean
isError()
Returns TRUE if the cache is in a error statusboolean
Returns TRUE is a refresh is needed (missing / expired data)boolean
Returns TRUE if the cache is in TO_BE_DELETED statusvoid
Set the context as REFRESH_NEEDEDvoid
state
(CacheState newState) This method operates a state changevoid
sync()
Set the context as SYNCHRONIZEDvoid
Updates the lastSuccessSynchronization datevoid
Set the context as TO_BE_DELETED
-
Method Details
-
getCurrentState
CacheStateEnum getCurrentState()Returns the current state in the cache- Returns:
- the Cache state
-
getLastStateTransitionTime
Date getLastStateTransitionTime()Returns the date of the last state transition- Returns:
- the last date when the state has had a transition
-
getLastSuccessSynchronizationTime
Date getLastSuccessSynchronizationTime()Returns the last time when the cache has been synchronized successfully NOTE: can be null in case if the cache has never been synchronized- Returns:
- the last date when the state has been synchronized
-
state
This method operates a state change- Parameters:
newState
- the new state to be assigned
-
desync
void desync()Set the context as DESYNCHRONIZED -
sync
void sync()Set the context as SYNCHRONIZED -
refreshNeeded
void refreshNeeded()Set the context as REFRESH_NEEDED -
toBeDeleted
void toBeDeleted()Set the context as TO_BE_DELETED -
isRefreshNeeded
boolean isRefreshNeeded()Returns TRUE is a refresh is needed (missing / expired data)- Returns:
- TRUE if a refresh is required
-
syncUpdateDate
void syncUpdateDate()Updates the lastSuccessSynchronization date -
isError
boolean isError()Returns TRUE if the cache is in a error status- Returns:
- TRUE if an exception is stored
-
error
Store the exception for its occurrence time- Parameters:
exception
- an instance ofCachedExceptionWrapper
-
errorUpdateDate
Store the last occurrence of this exception- Parameters:
updatedException
- an instance ofCachedExceptionWrapper
-
getException
CachedExceptionWrapper getException()Returns the met exception- Returns:
- an object with the exception and its occurrence time
-
isToBeDeleted
boolean isToBeDeleted()Returns TRUE if the cache is in TO_BE_DELETED status- Returns:
- TRUE if the entry must be deleted
-
isDesync
boolean isDesync()Returns TRUE if the cache is in DESYNC status- Returns:
- TRUE if the entry is desynchronized
-