A
- The type of the action.R
- The type of the result.public class ActionCachingHandler<A,R> extends AbstractCachingClientActionHandler<A,R>
AbstractCachingClientActionHandler
. It supports action cachingConstructor and Description |
---|
ActionCachingHandler(Class<A> actionType,
Cache cache) |
Modifier and Type | Method and Description |
---|---|
protected void |
postfetch(A action,
R result)
Override this method to perform an action after the call to the server returns successfully or not.
|
protected R |
prefetch(A action)
Override this method to perform an action before the call is sent to the server.
|
execute, getCache, undo
getActionType
protected void postfetch(A action, R result)
AbstractCachingClientActionHandler
null
will be passed in the result
parameter.
You can use this method to add the result to cache, if it is null
you should remove the action
from the cache.postfetch
in class AbstractCachingClientActionHandler<A,R>
action
- The action that just finished execution on the server.result
- The result after the server call, or null
if the server call failed.protected R prefetch(A action)
AbstractCachingClientActionHandler
null
result then the action is never executed on the server and the returned value is used. If the
call returns null
then the action is executed on the server.
You can use this method to fetch the action
from the cache.prefetch
in class AbstractCachingClientActionHandler<A,R>
action
- The action to be prefetchednull
.Copyright © 2010–2014 Arcbees. All rights reserved.