public final class CacheMethods extends Object
Constructor and Description |
---|
CacheMethods() |
Modifier and Type | Method and Description |
---|---|
static <K,V> Map<K,V> |
cacheGet(String cacheName,
Collection<?> keys) |
static <T> T |
cacheGet(String cacheName,
Object key) |
static <T> T |
cacheGet(String cacheName,
Object key,
Closure loader) |
static <T> T |
cacheGet(String cacheName,
Object key,
T defaultValue) |
static void |
cacheInvalidate(String cacheName,
Object key) |
static void |
cacheInvalidateAll(String cacheName,
Collection<?> keys) |
static void |
cachePut(String cacheName,
Object key,
Object value) |
static void |
cachePutAll(String cacheName,
Map<?,?> entries) |
@GloopParameter(name="value", value="The cached value, or null") @GloopComment(value="Returns the value in the cache for the given key or null if no value was cached for that key.") public static <T> T cacheGet(@GloopParameter(value="Cache name in the current package",allowNull=false) String cacheName, @GloopParameter(value="The cache entry\'s associated key",allowNull=false) Object key)
cacheName
- Cache name in the current packagekey
- The cache entry's associated keynull
io.toro.martini.cache.CacheManagerException
- if cache couldn't be constructed from cacheName
@GloopParameter(name="values", value="The cached values, or an empty map") @GloopComment(value="Returns the values in the cache for the given keys as a map or an empty map if no values were cached for those keys.") public static <K,V> Map<K,V> cacheGet(@GloopParameter(value="Cache name in the current package",allowNull=false) String cacheName, @GloopParameter(value="The keys for the entries that need to be fetched",allowNull=false) Collection<?> keys)
cacheName
- Cache name in the current packagekeys
- The keys for the entries that need to be fetched@GloopParameter(name="value", value="The cached value, or the value returned by the closure") @GloopComment(value="Returns the value in the cache for the given key or the value returned by the closure if no value was cached for that key.") public static <T> T cacheGet(@GloopParameter(value="Cache name in the current package",allowNull=false) String cacheName, @GloopParameter(value="The cache entry\'s associated key",allowNull=false) Object key, @GloopParameter(value="The closure that loads the value for key if it doesn\'t exist",allowNull=false) Closure loader)
cacheName
- Cache name in the current packagekey
- The cache entry's associated keyloader
- The closure that loads the value for key
if it doesn't existnull
@GloopParameter(name="value", value="The cached value, or the defaultValue") @GloopComment(value="Returns the value in the cache for the given key or the default value if no value was cached for that key.") public static <T> T cacheGet(@GloopParameter(value="Cache name in the current package",allowNull=false) String cacheName, @GloopParameter(value="The cache entry\'s associated key",allowNull=false) Object key, @GloopParameter(value="The defaultValue if no value is cached") T defaultValue)
cacheName
- Cache name in the current packagekey
- The cache entry's associated keydefaultValue
- The value for key
if it doesn't existnull
@GloopComment(value="Puts the value in the cache for with given key.") public static void cachePut(@GloopParameter(value="Cache name in the current package",allowNull=false) String cacheName, @GloopParameter(value="The cache key",allowNull=false) Object key, @GloopParameter(value="The cache value",allowNull=false) Object value)
cacheName
- Cache name in the current packagekey
- The cache keyvalue
- The cache value@GloopComment(value="Puts the entries in the cache.") public static void cachePutAll(@GloopParameter(value="Cache name in the current package",allowNull=false) String cacheName, @GloopParameter(value="The cache entries",allowNull=false) Map<?,?> entries)
cacheName
- Cache name in the current packageentries
- The entries to put in cache@GloopComment(value="Invalidates the given key in the cache.") public static void cacheInvalidate(@GloopParameter(value="Cache name in the current package",allowNull=false) String cacheName, @GloopParameter(value="The key to invalidate",allowNull=false) Object key)
cacheName
- Cache name in the current packagekey
- The key to invalidate@GloopComment(value="Invalidates the given keys in the cache.") public static void cacheInvalidateAll(@GloopParameter(value="Cache name in the current package",allowNull=false) String cacheName, @GloopParameter(value="The keys to invalidate",allowNull=false) Collection<?> keys)
cacheName
- Cache name in the current packagekeys
- The keys to invalidateCopyright © 2019. All rights reserved.