Class CaffeineCache<K,V>
java.lang.Object
org.incendo.cloud.processors.cache.CaffeineCache<K,V>
- Type Parameters:
K- key typeV- value type
- All Implemented Interfaces:
CloudCache<K,V>
@API(status=STABLE,
since="1.0.0")
public final class CaffeineCache<K,V>
extends Object
implements CloudCache<K,V>
An implementation of
CloudCache backed by a Caffeine Cache.- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidDeletes the entry identified by the givenkey.getIfPresent(@NonNull K key) Returns the value identified by the givenkey, if it exists.static <K,V> @NonNull CloudCache<K, V> Creates a newCaffeineCachebacked by the given Guavacache.voidStores the givenvalueidentified by the givenkey.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.incendo.cloud.processors.cache.CloudCache
get, keyExtractingView, popIfPresent
-
Method Details
-
of
public static <K,V> @NonNull CloudCache<K,V> of(@NonNull com.github.benmanes.caffeine.cache.Cache<K, V> cache) Creates a newCaffeineCachebacked by the given Guavacache.- Type Parameters:
K- key typeV- value type- Parameters:
cache- backing cache- Returns:
- the created cache instance
-
delete
Description copied from interface:CloudCacheDeletes the entry identified by the givenkey.- Specified by:
deletein interfaceCloudCache<K,V> - Parameters:
key- the key
-
put
Description copied from interface:CloudCacheStores the givenvalueidentified by the givenkey.- Specified by:
putin interfaceCloudCache<K,V> - Parameters:
key- the keyvalue- the value
-
getIfPresent
Description copied from interface:CloudCacheReturns the value identified by the givenkey, if it exists.- Specified by:
getIfPresentin interfaceCloudCache<K,V> - Parameters:
key- the key- Returns:
- the value, or
null
-