Package org.cache2k.core.operation
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 voidentryResult(ExaminationEntry<K,V> e)Returns a cache entry as result.voidexpire(long expiryTime)Reset expiry to the specified value.voidfailure(RuntimeException t)Bad things happened, propagate the exception to the client.org.cache2k.io.ExceptionPropagatorgetExceptionPropagator()Exception propagator in effect.longgetMutationStartTime()The current time in millis or the value when it was first called.booleanisDataFresh()Entry has valid data in the cache and is not expired.booleanisDataFreshOrMiss()Entry has valid data in the cache and is not expired.booleanisDataRefreshing()True if the entry is refreshing or refreshed and in refresh probation.booleanisExpiryTimeReachedOrInRefreshProbation()Entry reached the expiry time and expiry event can be sent and entry state can be changed to expired.booleanisLoaderPresent()A loader is present and the cache operates in read through.voidload()Request that the entry value gets loaded from loader.voidloadAndRestart()Request a load, and then call examine again to reevaluate.voidnoMutation()No mutation is done.voidput(V value)Update the entry with the new value.voidputAndSetExpiry(V value, long expiryTime, long refreshTime)Set new value, skip expiry calculation and set expiry time directly.voidrefresh()Same as load but counting statistics as refresh.voidremove()The entry will be removed.voidresult(R result)Sets the operation result.voidresultOrWrapper(Object result)Sets the result or a wrappervoidwantData()Requests that the cache content for an entry will be provided.voidwantMutation()The entry gets locked for mutation.booleanwasLoaded()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.
-
wantData
void wantData()
Requests that the cache content for an entry will be provided. If the cache is tiered, the data will be read into the heap cache. Last command of semantic method. Calls back onSemantic.examine(Object, Progress, ExaminationEntry)
-
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.
-
wantMutation
void wantMutation()
The entry gets locked for mutation. Last command of semantic method. CallsSemantic.examine(Object, Progress, ExaminationEntry)again after lock is obtain to assess the the state again. Calls back onSemantic.mutate(Object, Progress, ExaminationEntry)if lock is already taken.
-
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 inSemantic.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.
-
-