Interface Cache<K,V>


public interface Cache<K,V>
Represents base Cache contract.
  • Method Details

    • asLoadable

      @Nonnull default LoadableCache<K,V> asLoadable(@Nonnull CacheLoader<K,V> cacheLoader)
    • get

      @Nullable V get(@Nonnull K key)
      Resolve the given value for the given key.
      Parameters:
      key - The cache key
      Returns:
      value associated with the key
    • get

      @Nonnull Map<K,V> get(@Nonnull Collection<K> keys)
    • getAsync

      @Nonnull reactor.core.publisher.Mono<V> getAsync(@Nonnull K key)
      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

      @Nonnull reactor.core.publisher.Mono<Map<K,V>> getAsync(@Nonnull Collection<K> keys)
    • put

      @Nonnull V put(@Nonnull K key, @Nonnull V value)
      Cache the specified value using the specified key.
      Parameters:
      key - the key with which the specified value is to be associated
      value - the value to be associated with the specified key
    • computeIfAbsent

      V computeIfAbsent(@Nonnull K key, @Nonnull Function<K,V> mappingFunction)
      Parameters:
      key - to look for value or compute and put if absent
      mappingFunction - 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 absent
      mappingFunction - to use for value computing
      Returns:
      existing or computed value
    • invalidate

      void invalidate(@Nonnull K key)
      Invalidate the value for the given key.
      Parameters:
      key - The key to invalid
    • invalidate

      void invalidate(@Nonnull Collection<K> keys)
    • invalidateAll

      void invalidateAll()
      Invalidate all cached values within this cache.
    • putAsync

      @Nonnull reactor.core.publisher.Mono<V> putAsync(@Nonnull K key, @Nonnull V value)
      Cache the specified value using the specified key.
      Parameters:
      key - the key with which the specified value is to be associated
      value - 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 absent
      mappingFunction - 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 absent
      mappingFunction - to use for value computing
      Returns:
      existing or computed value
    • invalidateAsync

      @Nonnull reactor.core.publisher.Mono<Boolean> invalidateAsync(@Nonnull K key)
      Invalidate the value for the given key.
      Parameters:
      key - The key to invalid
    • invalidateAsync

      reactor.core.publisher.Mono<Boolean> invalidateAsync(@Nonnull Collection<K> keys)
    • invalidateAllAsync

      @Nonnull reactor.core.publisher.Mono<Boolean> invalidateAllAsync()
      Invalidate all cached values within this cache.