Interface CacheContext

All Known Implementing Classes:
CurrentCacheContext

public interface CacheContext
Contains information for a Cache entry
  • 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

      void state(CacheState newState)
      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

      void error(CachedExceptionWrapper exception)
      Store the exception for its occurrence time
      Parameters:
      exception - an instance of CachedExceptionWrapper
    • errorUpdateDate

      void errorUpdateDate(CachedExceptionWrapper updatedException)
      Store the last occurrence of this exception
      Parameters:
      updatedException - an instance of CachedExceptionWrapper
    • 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