Package org.faktorips.runtime
Class SimpleCache
- java.lang.Object
-
- org.faktorips.runtime.SimpleCache
-
- All Implemented Interfaces:
IComputable<java.lang.Object,java.lang.Object>
public class SimpleCache extends java.lang.Object implements IComputable<java.lang.Object,java.lang.Object>
Simple cache that just uses a HashMap to cache objects and never releases them. This Cache is thread safe but not very high-performance.- Author:
- Jan Ortmann
-
-
Constructor Summary
Constructors Constructor Description SimpleCache(IComputable<java.lang.Object,java.lang.Object> computable)SimpleCache(IComputable<java.lang.Object,java.lang.Object> computable, int initialCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectcompute(java.lang.Object key)Compute an object of type V identified by the key of type Kjava.lang.Class<? super java.lang.Object>getValueClass()Getting theClassof the value this computable produces.
-
-
-
Constructor Detail
-
SimpleCache
public SimpleCache(IComputable<java.lang.Object,java.lang.Object> computable)
-
SimpleCache
public SimpleCache(IComputable<java.lang.Object,java.lang.Object> computable, int initialCapacity)
-
-
Method Detail
-
compute
public java.lang.Object compute(java.lang.Object key) throws java.lang.InterruptedExceptionDescription copied from interface:IComputableCompute an object of type V identified by the key of type K- Specified by:
computein interfaceIComputable<java.lang.Object,java.lang.Object>- Parameters:
key- the key to identify the object- Returns:
- the computed Object of type V
- Throws:
java.lang.InterruptedException- When computation was interrupted
-
getValueClass
public java.lang.Class<? super java.lang.Object> getValueClass()
Description copied from interface:IComputableGetting theClassof the value this computable produces.- Specified by:
getValueClassin interfaceIComputable<java.lang.Object,java.lang.Object>
-
-