Package ru.tinkoff.kora.cache
Interface Cache<K,V>
public interface Cache<K,V>
Represents base Cache contract.
-
Method Summary
Modifier and TypeMethodDescriptiondefault LoadableCache<K,V> asLoadable(CacheLoader<K, V> cacheLoader) computeIfAbsent(Collection<K> keys, Function<Set<K>, Map<K, V>> mappingFunction) computeIfAbsent(K key, Function<K, V> mappingFunction) computeIfAbsentAsync(Collection<K> keys, Function<Set<K>, reactor.core.publisher.Mono<Map<K, V>>> mappingFunction) reactor.core.publisher.Mono<V>computeIfAbsentAsync(K key, Function<K, reactor.core.publisher.Mono<V>> mappingFunction) get(Collection<K> keys) Resolve the given value for the given key.getAsync(Collection<K> keys) reactor.core.publisher.Mono<V>Resolve the given value for the given key.voidinvalidate(Collection<K> keys) voidinvalidate(K key) Invalidate the value for the given key.voidInvalidate all cached values within this cache.reactor.core.publisher.Mono<Boolean>Invalidate all cached values within this cache.reactor.core.publisher.Mono<Boolean>invalidateAsync(Collection<K> keys) reactor.core.publisher.Mono<Boolean>invalidateAsync(K key) Invalidate the value for the given key.Cache the specified value using the specified key.reactor.core.publisher.Mono<V>Cache the specified value using the specified key.
-
Method Details
-
asLoadable
-
get
Resolve the given value for the given key.- Parameters:
key- The cache key- Returns:
- value associated with the key
-
get
-
getAsync
Resolve the given value for the given key.- Parameters:
key- The cache key- Returns:
- value associated with the key or
Mono.empty()if no value is specified
-
getAsync
-
put
Cache the specified value using the specified key.- Parameters:
key- the key with which the specified value is to be associatedvalue- the value to be associated with the specified key
-
computeIfAbsent
- Parameters:
key- to look for value or compute and put if absentmappingFunction- to use for value computing- Returns:
- existing or computed value
-
computeIfAbsent
@Nonnull Map<K,V> computeIfAbsent(@Nonnull Collection<K> keys, @Nonnull Function<Set<K>, Map<K, V>> mappingFunction) - Parameters:
keys- to look for value or compute and put if absentmappingFunction- to use for value computing- Returns:
- existing or computed value
-
invalidate
Invalidate the value for the given key.- Parameters:
key- The key to invalid
-
invalidate
-
invalidateAll
void invalidateAll()Invalidate all cached values within this cache. -
putAsync
Cache the specified value using the specified key.- Parameters:
key- the key with which the specified value is to be associatedvalue- the value to be associated with the specified key- Returns:
- Void
-
computeIfAbsentAsync
reactor.core.publisher.Mono<V> computeIfAbsentAsync(@Nonnull K key, @Nonnull Function<K, reactor.core.publisher.Mono<V>> mappingFunction) - Parameters:
key- to look for value or compute and put if absentmappingFunction- to use for value computing- Returns:
- existing or computed value
-
computeIfAbsentAsync
@Nonnull reactor.core.publisher.Mono<Map<K,V>> computeIfAbsentAsync(@Nonnull Collection<K> keys, @Nonnull Function<Set<K>, reactor.core.publisher.Mono<Map<K, V>>> mappingFunction) - Parameters:
keys- to look for value or compute and put if absentmappingFunction- to use for value computing- Returns:
- existing or computed value
-
invalidateAsync
Invalidate the value for the given key.- Parameters:
key- The key to invalid
-
invalidateAsync
-
invalidateAllAsync
Invalidate all cached values within this cache.
-