public class GuavaCacheService extends AbstractService implements CacheService
CacheService
implementation wrapping a guava Cache
.Constructor and Description |
---|
GuavaCacheService() |
Modifier and Type | Method and Description |
---|---|
Object |
get(Object key) |
<V> V |
get(Object key,
Callable<V> valueLoader) |
void |
initialize()
Performs any needed initialization when the service is first loaded.
|
void |
put(Object key,
Object value)
Stores the given object in the cache.
|
getContext, setContext, toString
getInfo, getPriority, setInfo, setPriority
context
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
registerEventHandlers
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
dispose
public void initialize()
Service
NB: This method is not intended to be called directly. It is called by
the service framework itself (specifically by the ServiceHelper
)
when initializing the service. It should not be called a second time.
initialize
in interface Initializable
initialize
in interface Service
public void put(Object key, Object value)
CacheService
put
in interface CacheService
key
- A key.value
- A value.public Object get(Object key)
get
in interface CacheService
key
- A keypublic <V> V get(Object key, Callable<V> valueLoader) throws ExecutionException
get
in interface CacheService
key
- A keyvalueLoader
- A value loader which will be used if null is returned
for the given key.ExecutionException
Copyright © 2015–2022 SciJava. All rights reserved.