Interface Cache<K,​V>

  • All Known Implementing Classes:
    Cache, LfuCache

    @ApiMayChange
    @DoNotInherit
    public interface Cache<K,​V>
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Clears the cache by removing all entries.
      java.util.concurrent.CompletionStage<V> getFuture​(K key, akka.japi.Creator<java.util.concurrent.CompletionStage<V>> genValue)
      Returns either the cached CompletionStage for the given key or evaluates the given value generating function producing a `CompletionStage`.
      java.util.Set<K> getKeys()
      Returns the set of keys in the cache, in no particular order Should return in roughly constant time.
      java.util.Optional<java.util.concurrent.CompletionStage<V>> getOptional​(K key)
      Retrieves the CompletionStage instance that is currently in the cache for the given key.
      java.util.concurrent.CompletionStage<V> getOrCreateStrict​(K key, akka.japi.Creator<V> block)
      Returns either the cached CompletionStage for the given key or the given value as a CompletionStage
      java.util.concurrent.CompletionStage<V> getOrFulfil​(K key, akka.japi.Procedure<java.util.concurrent.CompletableFuture<V>> f)
      Returns either the cached CompletionStage for the key, or evaluates the given function which should lead to eventual completion of the completable future.
      void remove​(K key)
      Removes the cache item for the given key.
      int size()
      Returns the upper bound for the number of currently cached entries.
    • Method Detail

      • getFuture

        java.util.concurrent.CompletionStage<V> getFuture​(K key,
                                                          akka.japi.Creator<java.util.concurrent.CompletionStage<V>> genValue)
        Returns either the cached CompletionStage for the given key or evaluates the given value generating function producing a `CompletionStage`.
      • getOrFulfil

        java.util.concurrent.CompletionStage<V> getOrFulfil​(K key,
                                                            akka.japi.Procedure<java.util.concurrent.CompletableFuture<V>> f)
        Returns either the cached CompletionStage for the key, or evaluates the given function which should lead to eventual completion of the completable future.
      • getOrCreateStrict

        java.util.concurrent.CompletionStage<V> getOrCreateStrict​(K key,
                                                                  akka.japi.Creator<V> block)
        Returns either the cached CompletionStage for the given key or the given value as a CompletionStage
      • getOptional

        java.util.Optional<java.util.concurrent.CompletionStage<V>> getOptional​(K key)
        Retrieves the CompletionStage instance that is currently in the cache for the given key. Returns None if the key has no corresponding cache entry.
      • remove

        void remove​(K key)
        Removes the cache item for the given key.
      • clear

        void clear()
        Clears the cache by removing all entries.
      • getKeys

        java.util.Set<K> getKeys()
        Returns the set of keys in the cache, in no particular order Should return in roughly constant time. Note that this number might not reflect the exact keys of active, unexpired cache entries, since expired entries are only evicted upon next access (or by being thrown out by a capacity constraint).
      • size

        int size()
        Returns the upper bound for the number of currently cached entries. Note that this number might not reflect the exact number of active, unexpired cache entries, since expired entries are only evicted upon next access (or by being thrown out by a capacity constraint).