Class CouchbaseCache
java.lang.Object
org.springframework.cache.support.AbstractValueAdaptingCache
org.springframework.data.couchbase.cache.CouchbaseCache
- All Implemented Interfaces:
Cache
Couchbase-backed Cache Methods that take a Class return non-wrapped objects - cache-miss cannot be distinguished from
cached null - this is what AbstractValueAdaptingCache does Methods that do not take a Class return wrapped objects -
the wrapper is null for cache-miss - the exception is T get(final Object key, final Callable<T> valueLoader), which
does not return a wrapper because if there is a cache-miss, it gets the value from valueLoader (and caches it). There
are anomalies with get(key, ValueLoader) - which returns non-wrapped object.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.cache.Cache
Cache.ValueRetrievalException, Cache.ValueWrapper -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCouchbaseCache(String name, CouchbaseCacheWriter cacheWriter, CouchbaseCacheConfiguration cacheConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()protected StringconvertKey(Object key) Convertkeyto aStringrepresentation used for cache key creation.protected StringcreateCacheKey(Object key) Customization hook for creating cache key before it gets serialized.voidbooleanevictIfPresent(Object key) <T> T<T> T<T> TReturns the configuration for thisCouchbaseCache.getName()booleanprotected Objectprotected Objectsame as inherited, but passes clazz for transcodervoidputIfAbsent(Object key, Object value) <T> TputIfAbsent(Object key, Object value, Class<T> clazz) Not sure why this isn't in AbstractValueAdaptingCacheMethods inherited from class org.springframework.cache.support.AbstractValueAdaptingCache
fromStoreValue, get, isAllowNullValues, toStoreValue, toValueWrapper
-
Constructor Details
-
CouchbaseCache
protected CouchbaseCache(String name, CouchbaseCacheWriter cacheWriter, CouchbaseCacheConfiguration cacheConfig)
-
-
Method Details
-
getName
-
getNativeCache
-
lookup
same as inherited, but passes clazz for transcoder -
lookup
- Specified by:
lookupin classAbstractValueAdaptingCache
-
getCacheConfiguration
Returns the configuration for thisCouchbaseCache. -
get
-
get
- Specified by:
getin interfaceCache- Overrides:
getin classAbstractValueAdaptingCache
-
get
-
put
-
putIfAbsent
-
putIfAbsent
Not sure why this isn't in AbstractValueAdaptingCache- Type Parameters:
T-- Parameters:
key-value-clazz-- Returns:
-
evict
-
evictIfPresent
-
invalidate
public boolean invalidate() -
clear
public void clear() -
createCacheKey
Customization hook for creating cache key before it gets serialized.- Parameters:
key- will never be null.- Returns:
- never null.
-
convertKey
Convertkeyto aStringrepresentation used for cache key creation.- Parameters:
key- will never be null.- Returns:
- never null.
- Throws:
IllegalStateException- ifkeycannot be converted toString.
-