Interface RSetCacheReactive<V>

Type Parameters:
V - value
All Superinterfaces:
RCollectionReactive<V>, RDestroyable, RExpirableReactive, RObjectReactive

public interface RSetCacheReactive<V> extends RCollectionReactive<V>, RDestroyable
Reactive interface for RSetCache object
Author:
Nikita Koksharov
  • Method Details

    • getPermitExpirableSemaphore

      RPermitExpirableSemaphoreReactive getPermitExpirableSemaphore(V value)
      Returns RPermitExpirableSemaphore instance associated with value
      Parameters:
      value - - set value
      Returns:
      RPermitExpirableSemaphore object
    • getSemaphore

      RSemaphoreReactive getSemaphore(V value)
      Returns RSemaphore instance associated with value
      Parameters:
      value - - set value
      Returns:
      RSemaphore object
    • getFairLock

      RLockReactive getFairLock(V value)
      Returns RLock instance associated with value
      Parameters:
      value - - set value
      Returns:
      RLock object
    • getReadWriteLock

      RReadWriteLockReactive getReadWriteLock(V value)
      Returns RReadWriteLock instance associated with value
      Parameters:
      value - - set value
      Returns:
      RReadWriteLock object
    • getLock

      RLockReactive getLock(V value)
      Returns lock instance associated with value
      Parameters:
      value - - set value
      Returns:
      RLock object
    • add

      reactor.core.publisher.Mono<Boolean> add(V value, long ttl, TimeUnit unit)
      Stores value with specified time to live. Value expires after specified time to live.
      Parameters:
      value - to add
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      unit - - time unit
      Returns:
      true if value has been added. false if value already been in collection.
    • size

      reactor.core.publisher.Mono<Integer> size()
      Returns the number of elements in cache. This number can reflects expired elements too due to non realtime cleanup process.
      Specified by:
      size in interface RCollectionReactive<V>
      Returns:
      size of collection
    • readAll

      reactor.core.publisher.Mono<Set<V>> readAll()
      Read all elements at once
      Returns:
      values
    • tryAdd

      reactor.core.publisher.Mono<Boolean> tryAdd(V... values)
      Tries to add elements only if none of them in set.
      Parameters:
      values - - values to add
      Returns:
      true if elements successfully added, otherwise false.
    • tryAdd

      reactor.core.publisher.Mono<Boolean> tryAdd(long ttl, TimeUnit unit, V... values)
      Tries to add elements only if none of them in set.
      Parameters:
      values - - values to add
      ttl - - time to live for value. If 0 then stores infinitely.
      unit - - time unit
      Returns:
      true if elements successfully added, otherwise false.
    • addIfAbsent

      reactor.core.publisher.Mono<Boolean> addIfAbsent(Duration ttl, V object)
      Adds element to this set only if has not been added before.

      Requires Redis 3.0.2 and higher.

      Parameters:
      ttl - - object ttl
      object - - object itself
      Returns:
      true if element added and false if not.
    • addIfExists

      reactor.core.publisher.Mono<Boolean> addIfExists(Duration ttl, V object)
      Adds element to this set only if it's already exists.

      Requires Redis 3.0.2 and higher.

      Parameters:
      ttl - - object ttl
      object - - object itself
      Returns:
      true if element added and false if not.
    • addIfLess

      reactor.core.publisher.Mono<Boolean> addIfLess(Duration ttl, V object)
      Adds element to this set only if new ttl less than current ttl of existed element.

      Requires Redis 6.2.0 and higher.

      Parameters:
      ttl - - object ttl
      object - - object itself
      Returns:
      true if element added and false if not.
    • addIfGreater

      reactor.core.publisher.Mono<Boolean> addIfGreater(Duration ttl, V object)
      Adds element to this set only if new ttl greater than current ttl of existed element.

      Requires Redis 6.2.0 and higher.

      Parameters:
      ttl - - object ttl
      object - - object itself
      Returns:
      true if element added and false if not.
    • addAll

      reactor.core.publisher.Mono<Integer> addAll(Map<V,Duration> objects)
      Adds all elements contained in the specified map to this sorted set. Map contains of ttl mapped by object.
      Parameters:
      objects - - map of elements to add
      Returns:
      amount of added elements, not including already existing in this sorted set
    • addAllIfAbsent

      reactor.core.publisher.Mono<Integer> addAllIfAbsent(Map<V,Duration> objects)
      Adds elements to this set only if they haven't been added before.

      Requires Redis 3.0.2 and higher.

      Parameters:
      objects - map of elements to add
      Returns:
      amount of added elements
    • addAllIfExist

      reactor.core.publisher.Mono<Integer> addAllIfExist(Map<V,Duration> objects)
      Adds elements to this set only if they already exist.

      Requires Redis 3.0.2 and higher.

      Parameters:
      objects - map of elements to add
      Returns:
      amount of added elements
    • addAllIfGreater

      reactor.core.publisher.Mono<Integer> addAllIfGreater(Map<V,Duration> objects)
      Adds elements to this set only if new ttl greater than current ttl of existed elements.

      Requires Redis 6.2.0 and higher.

      Parameters:
      objects - map of elements to add
      Returns:
      amount of added elements
    • addAllIfLess

      reactor.core.publisher.Mono<Integer> addAllIfLess(Map<V,Duration> objects)
      Adds elements to this set only if new ttl less than current ttl of existed elements.

      Requires Redis 6.2.0 and higher.

      Parameters:
      objects - map of elements to add
      Returns:
      amount of added elements