Interface MutinyCache<K,V>


@Experimental public interface MutinyCache<K,V>
A Reactive Cache provides a highly concurrent and distributed data structure, non blocking and using reactive streams.
Since:
14.0
  • Method Details

    • name

      String name()
      The name of the cache.
      Returns:
    • configuration

      io.smallrye.mutiny.Uni<CacheConfiguration> configuration()
      The configuration for this cache.
      Returns:
    • container

      MutinyContainer container()
      Return the container of this cache
      Returns:
    • get

      default io.smallrye.mutiny.Uni<V> get(K key)
      Get the value of the Key if such exists
      Parameters:
      key -
      Returns:
      the value
    • get

      default io.smallrye.mutiny.Uni<V> get(K key, CacheOptions options)
      Get the value of the Key if such exists
      Parameters:
      key -
      options -
      Returns:
      the value
    • getEntry

      default io.smallrye.mutiny.Uni<CacheEntry<K,V>> getEntry(K key)
      Parameters:
      key -
      Returns:
    • getEntry

      io.smallrye.mutiny.Uni<CacheEntry<K,V>> getEntry(K key, CacheOptions options)
      Parameters:
      key -
      options -
      Returns:
    • putIfAbsent

      default io.smallrye.mutiny.Uni<CacheEntry<K,V>> putIfAbsent(K key, V value)
      Insert the key/value if such key does not exist
      Parameters:
      key -
      value -
      Returns:
      the previous value if present
    • putIfAbsent

      io.smallrye.mutiny.Uni<CacheEntry<K,V>> putIfAbsent(K key, V value, CacheWriteOptions options)
      Parameters:
      key -
      value -
      options -
      Returns:
      the previous value if present
    • setIfAbsent

      default io.smallrye.mutiny.Uni<Boolean> setIfAbsent(K key, V value)
      Insert the key/value if such key does not exist
      Parameters:
      key -
      value -
      Returns:
    • setIfAbsent

      default io.smallrye.mutiny.Uni<Boolean> setIfAbsent(K key, V value, CacheWriteOptions options)
      Parameters:
      key -
      value -
      options -
      Returns:
    • put

      default io.smallrye.mutiny.Uni<CacheEntry<K,V>> put(K key, V value)
      Save the key/value. If the key exists will replace the value
      Parameters:
      key -
      value -
      Returns:
    • put

      io.smallrye.mutiny.Uni<CacheEntry<K,V>> put(K key, V value, CacheWriteOptions options)
      Parameters:
      key -
      value -
      options -
      Returns:
    • set

      default io.smallrye.mutiny.Uni<Void> set(K key, V value)
      Parameters:
      key -
      value -
      Returns:
    • set

      default io.smallrye.mutiny.Uni<Void> set(K key, V value, CacheWriteOptions options)
      Parameters:
      key -
      value -
      options -
      Returns:
    • remove

      default io.smallrye.mutiny.Uni<Boolean> remove(K key)
      Delete the key
      Parameters:
      key -
      Returns:
      true if the key existed and was removed, false if the key did not exist.
    • remove

      default io.smallrye.mutiny.Uni<Boolean> remove(K key, CacheOptions options)
      Delete the key
      Parameters:
      key -
      options -
      Returns:
      true if the key existed and was removed, false if the key did not exist.
    • getAndRemove

      default io.smallrye.mutiny.Uni<CacheEntry<K,V>> getAndRemove(K key)
      Removes the key and returns its value if present.
      Parameters:
      key -
      Returns:
      the value of the key before removal. Returns null if the key didn't exist.
    • getAndRemove

      io.smallrye.mutiny.Uni<CacheEntry<K,V>> getAndRemove(K key, CacheOptions options)
      Removes the key and returns its value if present.
      Parameters:
      key -
      options -
      Returns:
      the value of the key before removal. Returns null if the key didn't exist.
    • keys

      default io.smallrye.mutiny.Multi<K> keys()
      Retrieve all keys
      Returns:
    • keys

      default io.smallrye.mutiny.Multi<K> keys(CacheOptions options)
      Retrieve all keys
      Returns:
    • entries

      default io.smallrye.mutiny.Multi<CacheEntry<K,V>> entries()
      Retrieve all entries
      Returns:
    • entries

      io.smallrye.mutiny.Multi<CacheEntry<K,V>> entries(CacheOptions options)
      Retrieve all entries
      Parameters:
      options -
      Returns:
    • getAll

      default io.smallrye.mutiny.Multi<CacheEntry<K,V>> getAll(Set<K> keys)
      Retrieve all the entries for the specified keys.
      Parameters:
      keys -
      Returns:
    • getAll

      io.smallrye.mutiny.Multi<CacheEntry<K,V>> getAll(Set<K> keys, CacheOptions options)
      Retrieve all the entries for the specified keys.
      Parameters:
      keys -
      options -
      Returns:
    • getAll

      default io.smallrye.mutiny.Multi<CacheEntry<K,V>> getAll(K... keys)
      Parameters:
      keys -
      Returns:
    • getAll

      io.smallrye.mutiny.Multi<CacheEntry<K,V>> getAll(CacheOptions options, K... keys)
      Parameters:
      keys -
      options -
      Returns:
    • putAll

      default io.smallrye.mutiny.Uni<Void> putAll(io.smallrye.mutiny.Multi<CacheEntry<K,V>> pairs)
      Put multiple entries from a Multi
      Parameters:
      pairs -
      Returns:
      Void
    • putAll

      io.smallrye.mutiny.Uni<Void> putAll(io.smallrye.mutiny.Multi<CacheEntry<K,V>> pairs, CacheWriteOptions options)
      Parameters:
      pairs -
      options -
      Returns:
    • putAll

      io.smallrye.mutiny.Uni<Void> putAll(Map<K,V> map, CacheWriteOptions options)
      Parameters:
      map -
      options -
      Returns:
    • putAll

      default io.smallrye.mutiny.Uni<Void> putAll(Map<K,V> map)
    • replace

      default io.smallrye.mutiny.Uni<Boolean> replace(K key, V value, CacheEntryVersion version)
      Parameters:
      key -
      value -
      Returns:
    • replace

      default io.smallrye.mutiny.Uni<Boolean> replace(K key, V value, CacheEntryVersion version, CacheWriteOptions options)
      Parameters:
      key -
      value -
      options -
      Returns:
    • getOrReplaceEntry

      default io.smallrye.mutiny.Uni<CacheEntry<K,V>> getOrReplaceEntry(K key, V value, CacheEntryVersion version)
      Parameters:
      key -
      value -
      version -
      Returns:
    • getOrReplaceEntry

      io.smallrye.mutiny.Uni<CacheEntry<K,V>> getOrReplaceEntry(K key, V value, CacheEntryVersion version, CacheWriteOptions options)
      Parameters:
      key -
      value -
      options -
      version -
      Returns:
    • removeAll

      default io.smallrye.mutiny.Multi<K> removeAll(Set<K> keys)
      Removes a set of keys. Returns the keys that were removed.
      Parameters:
      keys -
      Returns:
    • removeAll

      io.smallrye.mutiny.Multi<K> removeAll(Set<K> keys, CacheWriteOptions options)
      Removes a set of keys. Returns the keys that were removed.
      Parameters:
      keys -
      options -
      Returns:
    • removeAll

      default io.smallrye.mutiny.Multi<K> removeAll(io.smallrye.mutiny.Multi<K> keys)
      Removes a set of keys. Returns the keys that were removed.
      Parameters:
      keys -
      Returns:
    • removeAll

      io.smallrye.mutiny.Multi<K> removeAll(io.smallrye.mutiny.Multi<K> keys, CacheWriteOptions options)
      Removes a set of keys. Returns the keys that were removed.
      Parameters:
      keys -
      options -
      Returns:
    • getAndRemoveAll

      default io.smallrye.mutiny.Multi<CacheEntry<K,V>> getAndRemoveAll(io.smallrye.mutiny.Multi<K> keys)
      Removes a set of keys. Returns the keys that were removed.
      Parameters:
      keys -
      Returns:
    • getAndRemoveAll

      default io.smallrye.mutiny.Multi<CacheEntry<K,V>> getAndRemoveAll(io.smallrye.mutiny.Multi<K> keys, CacheWriteOptions options)
      Removes a set of keys. Returns the keys that were removed.
      Parameters:
      keys -
      options -
      Returns:
    • estimateSize

      default io.smallrye.mutiny.Uni<Long> estimateSize()
      Estimate the size of the store
      Returns:
      Long, estimated size
    • estimateSize

      io.smallrye.mutiny.Uni<Long> estimateSize(CacheOptions options)
      Estimate the size of the store
      Parameters:
      options -
      Returns:
      Long, estimated size
    • clear

      default io.smallrye.mutiny.Uni<Void> clear()
      Clear the store. If a concurrent operation puts data in the store the clear might not properly work
      Returns:
      Void
    • clear

      io.smallrye.mutiny.Uni<Void> clear(CacheOptions options)
      Clear the store. If a concurrent operation puts data in the store the clear might not properly work
      Parameters:
      options -
      Returns:
      Void
    • query

      default <R> MutinyQuery<K,V,R> query(String query)
      Find by QueryRequest.
      Type Parameters:
      R -
      Parameters:
      query -
      Returns:
    • query

      <R> MutinyQuery<K,V,R> query(String query, CacheOptions options)
      Find by QueryRequest.
      Type Parameters:
      R -
      Parameters:
      query -
      options -
      Returns:
    • listen

      default io.smallrye.mutiny.Multi<CacheEntryEvent<K,V>> listen(CacheEntryEventType... types)
      Listens to the events
      Parameters:
      types -
      Returns:
      a Multi which produces CacheEntryEvent items.
    • listen

      io.smallrye.mutiny.Multi<CacheEntryEvent<K,V>> listen(CacheListenerOptions options, CacheEntryEventType... types)
      Listens to the events
      Parameters:
      options -
      types -
      Returns:
      a Multi which produces CacheEntryEvent items.
    • process

      default <T> io.smallrye.mutiny.Multi<CacheEntryProcessorResult<K,T>> process(Set<K> keys, MutinyCacheEntryProcessor<K,V,T> processor)
      Process the specified entries using the supplied processor
      Parameters:
      keys -
      processor -
    • process

      <T> io.smallrye.mutiny.Multi<CacheEntryProcessorResult<K,T>> process(Set<K> keys, MutinyCacheEntryProcessor<K,V,T> processor, CacheOptions options)
      Process the specified entries using the supplied processor
      Parameters:
      keys -
      processor -
      options -
    • streaming

      MutinyStreamingCache<K> streaming()
      Returns: