Class ViewBuilder
The ViewBuilder provides a means to #build() a view (ContinuousQueryCache) using a fluent pattern / style.
Inherited Members
Namespace: Tangosol.Net
Assembly: Coherence.dll
Syntax
public class ViewBuilder
Constructors
ViewBuilder(Func<INamedCache>)
Construct a new ViewBuilder for the provided INamedCache. The function should return a new NamedCache instance upon each invocation.
Declaration
public ViewBuilder(Func<INamedCache> supplierCache)
Parameters
Type | Name | Description |
---|---|---|
Func<INamedCache> | supplierCache | The function returning an INamedCache from which the view will be created. |
ViewBuilder(INamedCache)
Construct a new ViewBuilder for the provided INamedCache.
Declaration
public ViewBuilder(INamedCache cache)
Parameters
Type | Name | Description |
---|---|---|
INamedCache | cache | The INamedCache from which the view will be created. |
Methods
Build()
Construct a view of the INamedCache provided to this builder.
Declaration
public INamedCache Build()
Returns
Type | Description |
---|---|
INamedCache | The view of the NamedCache provided to this builder. |
Filter(IFilter)
The IFilter that will be used to define the entries maintained in this view. If no IFilter is specified, AlwaysFilter will be used.
Declaration
public ViewBuilder Filter(IFilter filter)
Parameters
Type | Name | Description |
---|---|---|
IFilter | filter | The IFilter that will be used to query the underlying INamedCache. |
Returns
Type | Description |
---|---|
ViewBuilder | This ViewBuilder. |
Keys()
The resulting view will only cache keys.
Declaration
public ViewBuilder Keys()
Returns
Type | Description |
---|---|
ViewBuilder | This ViewBuilder. |
Remarks
NOTE: this is mutually exclusive with #values().
Listener(ICacheListener)
The ICacheListener that will receive all events, including those that result from the initial population of the view.
Declaration
public ViewBuilder Listener(ICacheListener listener)
Parameters
Type | Name | Description |
---|---|---|
ICacheListener | listener | the ICacheListener that will receive all the events from the view, including those corresponding to its initial population. |
Returns
Type | Description |
---|---|
ViewBuilder | This ViewBuilder. |
Map(IValueExtractor)
The IValueExtractor that this view will use to transform the results from the underlying cache prior to storing them locally.
Declaration
public ViewBuilder Map(IValueExtractor mapper)
Parameters
Type | Name | Description |
---|---|---|
IValueExtractor | mapper | The IValueExtractor that will be used to transform values retrieved from the underlying cache before storing them locally; if specified, this view will become read-only. |
Returns
Type | Description |
---|---|
ViewBuilder | This ViewBuilder. |
Values()
The resulting view will cache both keys and values.
Declaration
public ViewBuilder Values()
Returns
Type | Description |
---|---|
ViewBuilder | This ViewBuilder. |
Remarks
NOTE: this is mutually exclusive with #keys().