Interface RMapCacheReactive<K,​V>

    • Method Detail

      • setMaxSize

        reactor.core.publisher.Mono<Void> setMaxSize​(int maxSize)
        Sets max size of the map. Superfluous elements are evicted using LRU algorithm.
        Parameters:
        maxSize - - max size
        Returns:
        void
      • trySetMaxSize

        reactor.core.publisher.Mono<Boolean> trySetMaxSize​(int maxSize)
        Tries to set max size of the map. Superfluous elements are evicted using LRU algorithm.
        Parameters:
        maxSize - - max size
        Returns:
        true if max size has been successfully set, otherwise false.
      • putIfAbsent

        reactor.core.publisher.Mono<V> putIfAbsent​(K key,
                                                   V value,
                                                   long ttl,
                                                   TimeUnit unit)
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live. Entry expires after specified time to live. If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        unit - - time unit
        Returns:
        previous associated value
      • putIfAbsent

        reactor.core.publisher.Mono<V> putIfAbsent​(K key,
                                                   V value,
                                                   long ttl,
                                                   TimeUnit ttlUnit,
                                                   long maxIdleTime,
                                                   TimeUnit maxIdleUnit)
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        previous associated value
      • put

        reactor.core.publisher.Mono<V> put​(K key,
                                           V value,
                                           long ttl,
                                           TimeUnit unit)
        Stores value mapped by key with specified time to live. Entry expires after specified time to live. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        unit - - time unit
        Returns:
        previous associated value
      • put

        reactor.core.publisher.Mono<V> put​(K key,
                                           V value,
                                           long ttl,
                                           TimeUnit ttlUnit,
                                           long maxIdleTime,
                                           TimeUnit maxIdleUnit)
        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        previous associated value
      • fastPut

        reactor.core.publisher.Mono<Boolean> fastPut​(K key,
                                                     V value,
                                                     long ttl,
                                                     TimeUnit unit)
        Stores value mapped by key with specified time to live. Entry expires after specified time to live.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Works faster than usual put(Object, Object, long, TimeUnit) as it not returns previous value.

        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        unit - - time unit
        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash and the value was updated.
      • fastPut

        reactor.core.publisher.Mono<Boolean> fastPut​(K key,
                                                     V value,
                                                     long ttl,
                                                     TimeUnit ttlUnit,
                                                     long maxIdleTime,
                                                     TimeUnit maxIdleUnit)
        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Works faster than usual put(Object, Object, long, TimeUnit, long, TimeUnit) as it not returns previous value.

        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash and the value was updated.
      • fastPutIfAbsent

        reactor.core.publisher.Mono<Boolean> fastPutIfAbsent​(K key,
                                                             V value,
                                                             long ttl,
                                                             TimeUnit ttlUnit,
                                                             long maxIdleTime,
                                                             TimeUnit maxIdleUnit)
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        Works faster than usual putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit) as it not returns previous value.

        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash
      • updateEntryExpiration

        reactor.core.publisher.Mono<Boolean> updateEntryExpiration​(K key,
                                                                   long ttl,
                                                                   TimeUnit ttlUnit,
                                                                   long maxIdleTime,
                                                                   TimeUnit maxIdleUnit)
        Updates time to live and max idle time of specified entry by key. Entry expires when specified time to live or max idle time was reached.

        Returns false if entry already expired or doesn't exist, otherwise returns true.

        Parameters:
        key - - map key
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        returns false if entry already expired or doesn't exist, otherwise returns true.
      • getWithTTLOnly

        reactor.core.publisher.Mono<V> getWithTTLOnly​(K key)
        Returns the value mapped by defined key or null if value is absent.

        If map doesn't contain value for specified key and MapLoader is defined then value will be loaded in read-through mode.

        Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.

        Parameters:
        key - the key
        Returns:
        the value mapped by defined key or null if value is absent
      • size

        reactor.core.publisher.Mono<Integer> size()
        Returns the number of entries in cache. This number can reflects expired entries too due to non realtime cleanup process.
        Specified by:
        size in interface RMapReactive<K,​V>
        Returns:
        size
      • remainTimeToLive

        reactor.core.publisher.Mono<Long> remainTimeToLive​(K key)
        Remaining time to live of map entry associated with a key.
        Parameters:
        key - - map key
        Returns:
        time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.