/** ConditionalPutAll is an EntryProcessor that performs an update operation for multiple entries that satisfy the specified condition.

This allows for concurrent insertion/update of values within the cache. For example a concurrent replaceAll(map) could be implemented as:

  filter = PresentFilter.INSTANCE;
cache.invokeAll(map.keys(), new ConditionalPutAll(filter, map));

or putAllIfAbsent could be done by inverting the filter:

  filter = new NotFilter(PresentFilter.INSTANCE);

Obviously, using more specific, fine-tuned filters may provide additional flexibility and efficiency allowing the multi-put operations to be performed conditionally on values of specific attributes (or even calculations) instead of a simple existence check.

Type Parameters

  • K = any

  • V = any

Hierarchy

Constructors

Properties

Methods

Constructors

  • Construct a ConditionalPutAll processor that updates an entry with a new value if and only if the filter applied to the entry evaluates to true. The new value is extracted from the specified map based on the entry's key.

    Type Parameters

    • K = any

    • V = any

    Parameters

    • filter: Filter

      the filter to evaluate all supplied entries

    • map: Map<K, V>

      a map of values to update entries with

    Returns ConditionalPutAll<K, V>

Properties

@class: string
entries: MapHolder<K, V>

Specifies the new value to update an entry with.

filter: Filter

The underlying filter.

Methods

  • Returns a ConditionalProcessor comprised of this processor and the provided filter.

    The specified entry processor gets invoked if and only if the filter applied to the entry evaluates to true; otherwise the result of the invocation will return null.

    Parameters

    Returns EntryProcessor<K, V, V>