+ return cache;
+ }
+
+ /**
+ * Callback invoked to compute an object if it was not found in the cache.
+ *
+ * @param <T>
+ * Type of the object
+ */
+ public static interface Computation<Key extends Serializable, Value extends Serializable> {
+ /**
+ * Gets the object. Called when the object is not in the cache.
+ * In case computation fails, an exception should be thrown to ensure that the last
+ * known value will be used.
+ *
+ * @param aObjectKey
+ * Id of the object in the cache.
+ *
+ * @return Object, must be non-null.
+ */
+ Value getObject(Key aObjectKey) throws Exception;