Interface CacheContext
- All Known Implementing Classes:
CurrentCacheContext
public interface CacheContext
-
Method Summary
Modifier and Type Method Description void
desync()
Set the context as DESYNCHRONIZEDvoid
error(CachedException exception)
Store the exception for its occurrence timevoid
errorUpdateDate(CachedException updatedException)
Store the last occurrence of this exceptionCacheStateEnum
getCurrentState()
Returns the current state in the cacheCachedException
getException()
Returns the met exceptionDate
getLastStateTransitionTime()
Returns the date of the last state transitionDate
getLastSuccessSynchronizationTime()
Returns 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
isRefreshNeeded()
Returns TRUE is a refresh is needed (missing / expired data)boolean
isToBeDeleted()
Returns TRUE if the cache is in TO_BE_DELETED statusvoid
refreshNeeded()
Set the context as REFRESH_NEEDEDvoid
state(CacheState newState)
This method operates a state changevoid
sync()
Set the context as SYNCHRONIZEDvoid
syncUpdateDate()
Updates the lastSuccessSynchronization datevoid
toBeDeleted()
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 ofCachedException
-
errorUpdateDate
Store the last occurrence of this exception- Parameters:
updatedException
- an instance ofCachedException
-
getException
CachedException 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
-