Interface Progress<K,​V,​R>

  • All Known Implementing Classes:
    EntryAction

    public interface Progress<K,​V,​R>
    Interface for cache operation semantics to control the progress of the processing.
    Author:
    Jens Wilke
    See Also:
    Semantic
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void entryResult​(ExaminationEntry<K,​V> e)
      Returns a cache entry as result.
      void expire​(long expiryTime)
      Reset expiry to the specified value.
      void failure​(RuntimeException t)
      Bad things happened, propagate the exception to the client.
      org.cache2k.io.ExceptionPropagator getExceptionPropagator()
      Exception propagator in effect.
      long getMutationStartTime()
      The current time in millis or the value when it was first called.
      boolean isDataFresh()
      Entry has valid data in the cache and is not expired.
      boolean isDataFreshOrMiss()
      Entry has valid data in the cache and is not expired.
      boolean isDataRefreshing()
      True if the entry is refreshing or refreshed and in refresh probation.
      boolean isExpiryTimeReachedOrInRefreshProbation()
      Entry reached the expiry time and expiry event can be sent and entry state can be changed to expired.
      boolean isLoaderPresent()
      A loader is present and the cache operates in read through.
      void load()
      Request that the entry value gets loaded from loader.
      void loadAndRestart()
      Request a load, and then call examine again to reevaluate.
      void noMutation()
      No mutation is done.
      void put​(V value)
      Update the entry with the new value.
      void putAndSetExpiry​(V value, long expiryTime, long refreshTime)
      Set new value, skip expiry calculation and set expiry time directly.
      void refresh()
      Same as load but counting statistics as refresh.
      void remove()
      The entry will be removed.
      void result​(R result)
      Sets the operation result.
      void resultOrWrapper​(Object result)
      Sets the result or a wrapper
      void wantData()
      Requests that the cache content for an entry will be provided.
      void wantMutation()
      The entry gets locked for mutation.
      boolean wasLoaded()
      Value was loaded before as part of this operation.
    • Method Detail

      • getMutationStartTime

        long getMutationStartTime()
        The current time in millis or the value when it was first called.
      • isLoaderPresent

        boolean isLoaderPresent()
        A loader is present and the cache operates in read through.
      • isDataFresh

        boolean isDataFresh()
        Entry has valid data in the cache and is not expired. This is used for operations that do not want to access the value. If needed this will check the clock.
      • isExpiryTimeReachedOrInRefreshProbation

        boolean isExpiryTimeReachedOrInRefreshProbation()
        Entry reached the expiry time and expiry event can be sent and entry state can be changed to expired.
      • isDataRefreshing

        boolean isDataRefreshing()
        True if the entry is refreshing or refreshed and in refresh probation.
      • isDataFreshOrMiss

        boolean isDataFreshOrMiss()
        Entry has valid data in the cache and is not expired. Counts a miss, if no entry is available, this is used for operations that do want to access the value.
      • wasLoaded

        boolean wasLoaded()
        Value was loaded before as part of this operation.
      • noMutation

        void noMutation()
        No mutation is done. Last command of semantic method.
      • result

        void result​(R result)
        Sets the operation result.
      • resultOrWrapper

        void resultOrWrapper​(Object result)
        Sets the result or a wrapper
      • entryResult

        void entryResult​(ExaminationEntry<K,​V> e)
        Returns a cache entry as result. The entry will be copied before returning.
      • getExceptionPropagator

        org.cache2k.io.ExceptionPropagator getExceptionPropagator()
        Exception propagator in effect.
      • load

        void load()
        Request that the entry value gets loaded from loader. Last command of semantic method. By default the loaded value will be set as operation result. Defined in Semantic.Base
      • refresh

        void refresh()
        Same as load but counting statistics as refresh. Last command of semantic method.
      • loadAndRestart

        void loadAndRestart()
        Request a load, and then call examine again to reevaluate. Last command of semantic method.
      • expire

        void expire​(long expiryTime)
        Reset expiry to the specified value. Don't change the value.
      • remove

        void remove()
        The entry will be removed. Last command of semantic method.
      • put

        void put​(V value)
        Update the entry with the new value. Last command of semantic method.
      • failure

        void failure​(RuntimeException t)
        Bad things happened, propagate the exception to the client. The original exception must be wrapped. The calling stacktrace will be filled into the wrapped exception before thrown. Last command of semantic method.
      • putAndSetExpiry

        void putAndSetExpiry​(V value,
                             long expiryTime,
                             long refreshTime)
        Set new value, skip expiry calculation and set expiry time directly.