Oracle® Coherence .NET API Reference Release 3.7.1
E22844-03
Assembly: Coherence (in Coherence.dll) Version: 3.7.1.23 (3.7.1.23)
System..::.Object
Tangosol.Util.Processor..::.AbstractProcessor
Tangosol.Util.Processor..::.ConditionalPut
E22844-03
ConditionalPut is an IEntryProcessor that
sets Valueif the specified
condition is satisfied.
Namespace:
Tangosol.Util.ProcessorAssembly: Coherence (in Coherence.dll) Version: 3.7.1.23 (3.7.1.23)
Syntax
| C# |
|---|
public class ConditionalPut : AbstractProcessor, IPortableObject |
Remarks
While the ConditionalPut processing could be implemented via direct key-based IQueryCache operations, it is more efficient and enforces concurrency control without explicit locking.
| IInvocableCache | IConcurrentCache |
|---|---|
| filter = PresentFilter.Instance; cache.Invoke(key, new ConditionalPut(filter, value)); | cache.Replace(key, value); |
| filter = new NotFilter(PresentFilter.Instance); cache.Invoke(key, new ConditionalPut(filter, value)); | cache.PutIfAbsent(key, value); |
| filter = new EqualsFilter(IdentityExtractor.Instance, valueOld); cache.Invoke(key, new ConditionalPut(filter, valueNew)); | cache.Replace(key, valueOld, valueNew); |
Obviously, using more specific, fine-tuned filters (rather than ones based on the IdentityExtractor may provide additional flexibility and efficiency allowing the put operation to be performed conditionally on values of specific attributes (or even calculations) instead of the entire object.
Inheritance Hierarchy
Tangosol.Util.Processor..::.AbstractProcessor
Tangosol.Util.Processor..::.ConditionalPut