Class RemoteCacheSupport<K,​V>

    • Field Detail

      • defaultLifespan

        protected long defaultLifespan
      • defaultMaxIdleTime

        protected long defaultMaxIdleTime
    • Constructor Detail

      • RemoteCacheSupport

        protected RemoteCacheSupport()
      • RemoteCacheSupport

        protected RemoteCacheSupport​(long defaultLifespan,
                                     long defaultMaxIdleTime)
    • Method Detail

      • putAll

        public final void putAll​(Map<? extends K,​? extends V> map,
                                 long lifespan,
                                 TimeUnit unit)
        Description copied from interface: RemoteCache
        Adds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.
        Specified by:
        putAll in interface BasicCache<K,​V>
        Specified by:
        putAll in interface RemoteCache<K,​V>
        Parameters:
        map - map containing mappings to enter
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
      • putAll

        public final void putAll​(Map<? extends K,​? extends V> map,
                                 long lifespan,
                                 TimeUnit lifespanUnit,
                                 long maxIdleTime,
                                 TimeUnit maxIdleTimeUnit)
        Description copied from interface: RemoteCache
        Adds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.
        Specified by:
        putAll in interface BasicCache<K,​V>
        Specified by:
        putAll in interface RemoteCache<K,​V>
        Parameters:
        map - map containing mappings to enter
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        See Also:
        RemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
      • putAllAsync

        public abstract CompletableFuture<Void> putAllAsync​(Map<? extends K,​? extends V> data,
                                                            long lifespan,
                                                            TimeUnit lifespanUnit,
                                                            long maxIdle,
                                                            TimeUnit maxIdleUnit)
        Description copied from interface: RemoteCache
        Adds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.
        Specified by:
        putAllAsync in interface AsyncCache<K,​V>
        Specified by:
        putAllAsync in interface RemoteCache<K,​V>
        Parameters:
        data - to store
        lifespan - lifespan of entry
        lifespanUnit - time unit for lifespan
        maxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleUnit - time unit for max idle time
        Returns:
        a future containing a void return type
        See Also:
        RemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
      • putIfAbsent

        public final V putIfAbsent​(K key,
                                   V value,
                                   long lifespan,
                                   TimeUnit unit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.
        Specified by:
        putIfAbsent in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • putIfAbsent

        public final V putIfAbsent​(K key,
                                   V value,
                                   long lifespan,
                                   TimeUnit lifespanUnit,
                                   long maxIdleTime,
                                   TimeUnit maxIdleTimeUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.
        Specified by:
        putIfAbsent in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • putIfAbsentAsync

        public abstract CompletableFuture<V> putIfAbsentAsync​(K key,
                                                              V value,
                                                              long lifespan,
                                                              TimeUnit lifespanUnit,
                                                              long maxIdle,
                                                              TimeUnit maxIdleUnit)
        Description copied from interface: AsyncCache
        Asynchronous version of BasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.
        Specified by:
        putIfAbsentAsync in interface AsyncCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of entry
        lifespanUnit - time unit for lifespan
        maxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleUnit - time unit for max idle time
        Returns:
        a future containing the old value replaced
      • replace

        public final boolean replace​(K key,
                                     V oldValue,
                                     V value,
                                     long lifespan,
                                     TimeUnit lifespanUnit,
                                     long maxIdleTime,
                                     TimeUnit maxIdleTimeUnit)
        Description copied from interface: RemoteCache
        An overloaded form of ConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.

        This method requires 2 round trips to the server. The first to retrieve the value and version and a second to replace the key with the version if the value matches. If possible user should use RemoteCache.getWithMetadata(Object) and RemoteCache.replaceWithVersion(Object, Object, long, long, TimeUnit, long, TimeUnit) if possible.

        Specified by:
        replace in interface BasicCache<K,​V>
        Specified by:
        replace in interface RemoteCache<K,​V>
        Parameters:
        key - key to use
        oldValue - value to replace
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        true if the value was replaced, false otherwise
      • replaceAsync

        public final CompletableFuture<Boolean> replaceAsync​(K key,
                                                             V oldValue,
                                                             V newValue)
        Description copied from interface: AsyncCache
        Asynchronous version of ConcurrentMap.replace(Object, Object, Object). This method does not block on remote calls, even if your cache mode is synchronous.
        Specified by:
        replaceAsync in interface AsyncCache<K,​V>
        Parameters:
        key - key to remove
        oldValue - value to overwrite
        newValue - value to store
        Returns:
        a future containing a boolean, indicating whether the entry was replaced or not
      • replaceAsync

        public final CompletableFuture<Boolean> replaceAsync​(K key,
                                                             V oldValue,
                                                             V newValue,
                                                             long lifespan,
                                                             TimeUnit unit)
        Description copied from interface: AsyncCache
        Asynchronous version of BasicCache.replace(Object, Object, Object, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.
        Specified by:
        replaceAsync in interface AsyncCache<K,​V>
        Parameters:
        key - key to remove
        oldValue - value to overwrite
        newValue - value to store
        lifespan - lifespan of entry
        unit - time unit for lifespan
        Returns:
        a future containing a boolean, indicating whether the entry was replaced or not
      • replaceAsync

        public abstract CompletableFuture<Boolean> replaceAsync​(K key,
                                                                V oldValue,
                                                                V newValue,
                                                                long lifespan,
                                                                TimeUnit lifespanUnit,
                                                                long maxIdle,
                                                                TimeUnit maxIdleUnit)
        Description copied from interface: AsyncCache
        Asynchronous version of BasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.
        Specified by:
        replaceAsync in interface AsyncCache<K,​V>
        Parameters:
        key - key to remove
        oldValue - value to overwrite
        newValue - value to store
        lifespan - lifespan of entry
        lifespanUnit - time unit for lifespan
        maxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleUnit - time unit for max idle time
        Returns:
        a future containing a boolean, indicating whether the entry was replaced or not
      • replace

        public final V replace​(K key,
                               V value,
                               long lifespan,
                               TimeUnit unit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.replace(Object, Object), which takes in lifespan parameters.
        Specified by:
        replace in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • replace

        public final V replace​(K key,
                               V value,
                               long lifespan,
                               TimeUnit lifespanUnit,
                               long maxIdleTime,
                               TimeUnit maxIdleTimeUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.replace(Object, Object), which takes in lifespan parameters.
        Specified by:
        replace in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • replaceAsync

        public abstract CompletableFuture<V> replaceAsync​(K key,
                                                          V value,
                                                          long lifespan,
                                                          TimeUnit lifespanUnit,
                                                          long maxIdle,
                                                          TimeUnit maxIdleUnit)
        Description copied from interface: AsyncCache
        Asynchronous version of BasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.
        Specified by:
        replaceAsync in interface AsyncCache<K,​V>
        Parameters:
        key - key to remove
        value - value to store
        lifespan - lifespan of entry
        lifespanUnit - time unit for lifespan
        maxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleUnit - time unit for max idle time
        Returns:
        a future containing the previous value overwritten
      • get

        public final V get​(Object key)
        Specified by:
        get in interface Map<K,​V>
      • getAsync

        public abstract CompletableFuture<V> getAsync​(K key)
        Description copied from interface: AsyncCache
        Asynchronous version of Map.get(Object) that allows user code to retrieve the value associated with a key at a later stage, hence allowing multiple parallel get requests to be sent. Normally, when this method detects that the value is likely to be retrieved from from a remote entity, it will span a different thread in order to allow the asynchronous get call to return immediately. If the call will definitely resolve locally, for example when the cache is configured with LOCAL mode and no stores are configured, the get asynchronous call will act sequentially and will have no different to Map.get(Object).
        Specified by:
        getAsync in interface AsyncCache<K,​V>
        Parameters:
        key - key to retrieve
        Returns:
        a future that can be used to retrieve value associated with the key when this is available. The actual value returned by the future follows the same rules as Map.get(Object)
      • getAll

        public final Map<K,​V> getAll​(Set<? extends K> keys)
        Description copied from interface: RemoteCache
        Retrieves all of the entries for the provided keys. A key will not be present in the resulting map if the entry was not found in the cache.
        Specified by:
        getAll in interface RemoteCache<K,​V>
        Parameters:
        keys - The keys to find values for
        Returns:
        The entries that were present for the given keys
      • containsKey

        public final boolean containsKey​(Object key)
        Specified by:
        containsKey in interface Map<K,​V>
      • put

        public final V put​(K key,
                           V value)
        Description copied from interface: BasicCache
        If the return value of this operation will be ignored by the application, the user is strongly encouraged to use the Flag.IGNORE_RETURN_VALUES flag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls).
        Specified by:
        put in interface BasicCache<K,​V>
        Specified by:
        put in interface Map<K,​V>
      • put

        public final V put​(K key,
                           V value,
                           long lifespan,
                           TimeUnit unit)
        Description copied from interface: BasicCache
        An overloaded form of BasicCache.put(Object, Object), which takes in lifespan parameters.
        Specified by:
        put in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • put

        public final V put​(K key,
                           V value,
                           long lifespan,
                           TimeUnit lifespanUnit,
                           long maxIdleTime,
                           TimeUnit maxIdleTimeUnit)
        Description copied from interface: BasicCache
        An overloaded form of BasicCache.put(Object, Object), which takes in lifespan parameters.
        Specified by:
        put in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • putAsync

        public final CompletableFuture<V> putAsync​(K key,
                                                   V value)
        Description copied from interface: AsyncCache
        Asynchronous version of BasicCache.put(Object, Object). This method does not block on remote calls, even if your cache mode is synchronous.
        Specified by:
        putAsync in interface AsyncCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        Returns:
        a future containing the old value replaced.
      • putAsync

        public final CompletableFuture<V> putAsync​(K key,
                                                   V value,
                                                   long lifespan,
                                                   TimeUnit unit)
        Description copied from interface: AsyncCache
        Asynchronous version of BasicCache.put(Object, Object, long, TimeUnit) . This method does not block on remote calls, even if your cache mode is synchronous.
        Specified by:
        putAsync in interface AsyncCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of entry
        unit - time unit for lifespan
        Returns:
        a future containing the old value replaced
      • putAsync

        public abstract CompletableFuture<V> putAsync​(K key,
                                                      V value,
                                                      long lifespan,
                                                      TimeUnit lifespanUnit,
                                                      long maxIdle,
                                                      TimeUnit maxIdleUnit)
        Description copied from interface: AsyncCache
        Asynchronous version of BasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.
        Specified by:
        putAsync in interface AsyncCache<K,​V>
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of entry
        lifespanUnit - time unit for lifespan
        maxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleUnit - time unit for max idle time
        Returns:
        a future containing the old value replaced
      • replaceWithVersion

        public final boolean replaceWithVersion​(K key,
                                                V newValue,
                                                long version,
                                                int lifespanSeconds)
        Description copied from interface: RemoteCache
        A overloaded form of RemoteCache.replaceWithVersion(Object, Object, long) which takes in lifespan parameters.
        Specified by:
        replaceWithVersion in interface RemoteCache<K,​V>
        Parameters:
        key - key to use
        newValue - new value to be associated with the key
        version - numeric version that should match the one in the server for the operation to succeed
        lifespanSeconds - lifespan of the entry
        Returns:
        true if the value was replaced
      • replaceWithVersion

        public final boolean replaceWithVersion​(K key,
                                                V newValue,
                                                long version,
                                                int lifespanSeconds,
                                                int maxIdleTimeSeconds)
        Description copied from interface: RemoteCache
        A overloaded form of RemoteCache.replaceWithVersion(Object, Object, long) which takes in lifespan and maximum idle time parameters.
        Specified by:
        replaceWithVersion in interface RemoteCache<K,​V>
        Parameters:
        key - key to use
        newValue - new value to be associated with the key
        version - numeric version that should match the one in the server for the operation to succeed
        lifespanSeconds - lifespan of the entry
        maxIdleTimeSeconds - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        Returns:
        true if the value was replaced
      • replaceWithVersion

        public final boolean replaceWithVersion​(K key,
                                                V newValue,
                                                long version,
                                                long lifespan,
                                                TimeUnit lifespanTimeUnit,
                                                long maxIdle,
                                                TimeUnit maxIdleTimeUnit)
        Description copied from interface: RemoteCache
        A overloaded form of RemoteCache.replaceWithVersion(Object, Object, long) which takes in lifespan and maximum idle time parameters.
        Specified by:
        replaceWithVersion in interface RemoteCache<K,​V>
        Parameters:
        key - key to use
        newValue - new value to be associated with the key
        version - numeric version that should match the one in the server for the operation to succeed
        lifespan - lifespan of the entry
        lifespanTimeUnit - TimeUnit for lifespan
        maxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - TimeUnit for maxIdle
        Returns:
        true if the value was replaced
      • remove

        public final V remove​(Object key)
        Description copied from interface: RemoteCache
        If the return value of this operation will be ignored by the application, the user is strongly encouraged to use the Flag.IGNORE_RETURN_VALUES flag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls).

        The returned value is only sent back if Flag.FORCE_RETURN_VALUE is enabled.

        Specified by:
        remove in interface BasicCache<K,​V>
        Specified by:
        remove in interface Map<K,​V>
        Specified by:
        remove in interface RemoteCache<K,​V>
      • removeWithVersion

        public final boolean removeWithVersion​(K key,
                                               long version)
        Description copied from interface: RemoteCache
        Removes the given entry only if its version matches the supplied version. A typical use case looks like this:
         VersionedEntry ve = remoteCache.getVersioned(key);
         //some processing
         remoteCache.removeWithVersion(key, ve.getVersion();
         
        Lat call (removeWithVersion) will make sure that the entry will only be removed if it hasn't been changed in between.
        Specified by:
        removeWithVersion in interface RemoteCache<K,​V>
        Returns:
        true if the entry has been removed
        See Also:
        VersionedValue, RemoteCache.getWithMetadata(Object)
      • merge

        public final V merge​(K key,
                             V value,
                             BiFunction<? super V,​? super V,​? extends V> remappingFunction,
                             long lifespan,
                             TimeUnit lifespanUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters.
        Specified by:
        merge in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        value - new value to merge with existing value
        remappingFunction - function to use to merge new and existing values into a merged value to store under key
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        Returns:
        the merged value that was stored under key
      • merge

        public final V merge​(K key,
                             V value,
                             BiFunction<? super V,​? super V,​? extends V> remappingFunction,
                             long lifespan,
                             TimeUnit lifespanUnit,
                             long maxIdleTime,
                             TimeUnit maxIdleTimeUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters.
        Specified by:
        merge in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        value - new value to merge with existing value
        remappingFunction - function to use to merge new and existing values into a merged value to store under key
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the merged value that was stored under key
      • clear

        public final void clear()
        Specified by:
        clear in interface Map<K,​V>
      • compute

        public final V compute​(K key,
                               BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                               long lifespan,
                               TimeUnit lifespanUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.compute(Object, BiFunction) which takes in lifespan parameters.
        Specified by:
        compute in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        remappingFunction - function to use to compute and store the value under key
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        Returns:
        the computed value that was stored under key
      • compute

        public final V compute​(K key,
                               BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                               long lifespan,
                               TimeUnit lifespanUnit,
                               long maxIdleTime,
                               TimeUnit maxIdleTimeUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.compute(Object, BiFunction) which takes in lifespan and maxIdleTime parameters.
        Specified by:
        compute in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        remappingFunction - function to use to compute and store the value under key
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the computed value that was stored under key
      • computeIfAbsent

        public final V computeIfAbsent​(K key,
                                       Function<? super K,​? extends V> mappingFunction,
                                       long lifespan,
                                       TimeUnit lifespanUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan parameters.
        Specified by:
        computeIfAbsent in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        mappingFunction - function to use to compute and store the value under key, if the key is absent
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        Returns:
        the computed value that was stored under key
      • computeIfAbsent

        public final V computeIfAbsent​(K key,
                                       Function<? super K,​? extends V> mappingFunction,
                                       long lifespan,
                                       TimeUnit lifespanUnit,
                                       long maxIdleTime,
                                       TimeUnit maxIdleTimeUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan and maxIdleTime parameters.
        Specified by:
        computeIfAbsent in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        mappingFunction - function to use to compute and store the value under key, if the key is absent
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the computed value that was stored under key
      • computeIfPresent

        public final V computeIfPresent​(K key,
                                        BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                                        long lifespan,
                                        TimeUnit lifespanUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan parameters.
        Specified by:
        computeIfPresent in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        remappingFunction - function to use to compute and store the value under key, if such exists
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        Returns:
        the computed value that was stored under key
      • computeIfPresent

        public final V computeIfPresent​(K key,
                                        BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                                        long lifespan,
                                        TimeUnit lifespanUnit,
                                        long maxIdleTime,
                                        TimeUnit maxIdleTimeUnit)
        Description copied from interface: BasicCache
        An overloaded form of ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan and maxIdleTime parameters.
        Specified by:
        computeIfPresent in interface BasicCache<K,​V>
        Parameters:
        key - key to use
        remappingFunction - function to use to compute and store the value under key, if such exists
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the computed value that was stored under key
      • size

        public final int size()
        Specified by:
        size in interface Map<K,​V>
      • sizeAsync

        public abstract CompletableFuture<Long> sizeAsync()
        Description copied from interface: AsyncCache
        Asynchronous version of Map.size(). This method does not block on remote calls, even if your cache mode is synchronous.
        Specified by:
        sizeAsync in interface AsyncCache<K,​V>
        Returns:
        a future containing the count of the cache