Interface CloudCache<K,V>

Type Parameters:
K - key type
V - value type
All Known Implementing Classes:
CaffeineCache, GuavaCache, SimpleCache

@API(status=STABLE, since="1.0.0") public interface CloudCache<K,V>
Something that caches values.

Standard implementations:

Since:
1.0.0
  • Method Details

    • delete

      void delete(@NonNull K key)
      Deletes the entry identified by the given key.
      Parameters:
      key - the key
    • put

      void put(@NonNull K key, @NonNull V value)
      Stores the given value identified by the given key.
      Parameters:
      key - the key
      value - the value
    • getIfPresent

      @Nullable V getIfPresent(@NonNull K key)
      Returns the value identified by the given key, if it exists.
      Parameters:
      key - the key
      Returns:
      the value, or null
    • popIfPresent

      default @Nullable V popIfPresent(@NonNull K key)
      Deletes the value identified by the given key and returns the value.
      Parameters:
      key - the key
      Returns:
      the value, or null
    • get

      default @NonNull Optional<V> get(@NonNull K key)
      Returns the value identified by the given key.
      Parameters:
      key - the key
      Returns:
      the value
    • keyExtractingView

      default <K1> @NonNull CloudCache<K1,V> keyExtractingView(@NonNull Function<K1,K> keyExtractor)
      Returns a view of this cache with an adapted key type.
      Type Parameters:
      K1 - key type for the view
      Parameters:
      keyExtractor - key extractor
      Returns:
      new view