public class CachingOperationInvoker extends Object implements OperationInvoker
OperationInvoker
that caches the response of an operation with a
configurable time to live.Constructor and Description |
---|
CachingOperationInvoker(OperationInvoker target,
long timeToLive)
Create a new instance with the target
OperationInvoker to use to compute
the response and the time to live for the cache. |
Modifier and Type | Method and Description |
---|---|
static OperationInvoker |
apply(OperationInvoker invoker,
long timeToLive)
Apply caching configuration when appropriate to the given invoker.
|
long |
getTimeToLive()
Return the maximum time in milliseconds that a response can be cached.
|
Object |
invoke(Map<String,Object> arguments)
Invoke the underlying operation using the given
arguments . |
public CachingOperationInvoker(OperationInvoker target, long timeToLive)
OperationInvoker
to use to compute
the response and the time to live for the cache.target
- the OperationInvoker
this instance wrapstimeToLive
- the maximum time in milliseconds that a response can be cachedpublic long getTimeToLive()
public Object invoke(Map<String,Object> arguments)
OperationInvoker
arguments
.invoke
in interface OperationInvoker
arguments
- the arguments to pass to the operationnull
public static OperationInvoker apply(OperationInvoker invoker, long timeToLive)
invoker
- the invoker to wraptimeToLive
- the maximum time in milliseconds that a response can be cachedCopyright © 2017 Pivotal Software, Inc.. All rights reserved.