public class ExpensiveOpCache
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ExpensiveOpCache.Op |
Constructor and Description |
---|
ExpensiveOpCache(ExpensiveOpCache.Op op,
int limitMs)
Cache the result of op for no more than limitMs milliseconds.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
doOp(java.lang.String key)
Do the operation if it has not been done, or if it has not been
done recently.
|
void |
reset() |
public ExpensiveOpCache(ExpensiveOpCache.Op op, int limitMs)
op
- limitMs
- public java.lang.Object doOp(java.lang.String key) throws java.lang.Exception
key
- Exception,
- see the given op.java.lang.Exception
public void reset()