IN - input type for that processorOUT - output type for that processorpublic final class CachingProcessor<IN extends MessageProvider,OUT extends MessageProvider> extends Object implements Processor<IN,OUT>
Processor
You can use this over whichever processor of your choice. Internally, it
uses a LoadingCache to store results.
You can optionally pass an Equivalence as an argument for cache
keys. By default, Equivalences.equals() will be used.
| Constructor and Description |
|---|
CachingProcessor(Processor<IN,OUT> processor)
Constructor
|
CachingProcessor(Processor<IN,OUT> processor,
Equivalence<IN> equivalence) |
CachingProcessor(Processor<IN,OUT> processor,
Equivalence<IN> equivalence,
int cacheSize)
Main constructor
|
| Modifier and Type | Method and Description |
|---|---|
OUT |
process(ProcessingReport report,
IN input)
Process the input
|
String |
toString() |
public CachingProcessor(Processor<IN,OUT> processor)
This is equivalent to calling CachingProcessor(Processor,
Equivalence) with Equivalences.equals() as the second argument.
processor - the processorpublic CachingProcessor(Processor<IN,OUT> processor, Equivalence<IN> equivalence)
public CachingProcessor(Processor<IN,OUT> processor, Equivalence<IN> equivalence, int cacheSize)
processor - the processorequivalence - an equivalence to use for cache keyscacheSize - the size of the cache, zero disables itNullPointerException - processor or equivalencepublic OUT process(ProcessingReport report, IN input) throws ProcessingException
Processorprocess in interface Processor<IN extends MessageProvider,OUT extends MessageProvider>report - the report to use while processinginput - the input for this processorProcessingException - processing failed