Package org.scijava.cache
Interface CacheService
-
- All Superinterfaces:
Comparable<Prioritized>,Contextual,Disposable,HasPluginInfo,Identifiable,Initializable,Locatable,Logged,Prioritized,RichPlugin,SciJavaPlugin,SciJavaService,Service,Versioned
- All Known Implementing Classes:
DefaultCacheService
public interface CacheService extends SciJavaService
Base interface for cache services in SciJava
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Objectget(Object key)default <V> Vget(Object key, Callable<V> valueLoader)voidput(Object key, Object value)Stores the given object in the cache.-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.Disposable
dispose
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
put
void put(Object key, Object value)
Stores the given object in the cache.- Parameters:
key- A key.value- A value.
-
get
Object get(Object key)
- Parameters:
key- A key- Returns:
- The cached object, or null if the object is not in the cache.
-
get
default <V> V get(Object key, Callable<V> valueLoader) throws ExecutionException
- Parameters:
key- A keyvalueLoader- A value loader which will be used if null is returned for the given key.- Returns:
- The cached object, or if the object is not in the cache the result of the value loader.
- Throws:
ExecutionException
-
-