Package com.openhtmltopdf.extend.impl
Class FSDefaultCacheStore
- java.lang.Object
-
- com.openhtmltopdf.extend.impl.FSDefaultCacheStore
-
- All Implemented Interfaces:
FSCacheEx<java.lang.String,FSCacheValue>
public class FSDefaultCacheStore extends java.lang.Object implements FSCacheEx<java.lang.String,FSCacheValue>
A simple default cache implementation, mainly for testing. For production you will probably want to wrap Guava's cache implementation or something similar. This implementation does not use synchronisation beyond using aConcurrentHashMap
internally. Specifically, theget(String, Callable)
may call the loader multiple times if called in close succession.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,FSCacheValue>
_store
-
Constructor Summary
Constructors Constructor Description FSDefaultCacheStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FSCacheValue
get(java.lang.String key)
FSCacheValue
get(java.lang.String key, java.util.concurrent.Callable<? extends FSCacheValue> loader)
void
put(java.lang.String key, FSCacheValue value)
-
-
-
Field Detail
-
_store
private final java.util.Map<java.lang.String,FSCacheValue> _store
-
-
Method Detail
-
put
public void put(java.lang.String key, FSCacheValue value)
- Specified by:
put
in interfaceFSCacheEx<java.lang.String,FSCacheValue>
-
get
public FSCacheValue get(java.lang.String key, java.util.concurrent.Callable<? extends FSCacheValue> loader)
- Specified by:
get
in interfaceFSCacheEx<java.lang.String,FSCacheValue>
-
get
public FSCacheValue get(java.lang.String key)
- Specified by:
get
in interfaceFSCacheEx<java.lang.String,FSCacheValue>
-
-