This class is a special Predicate which helps to get a page-by-page result of a query.
It can be constructed with a page-size, an inner predicate for filtering, and a comparator for sorting.
Inheritance Hierarchy
Hazelcast.CorePagingPredicate
Namespace: Hazelcast.Core
Assembly: Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.9
Syntax
The PagingPredicate type exposes the following members.
Constructors
Name | Description | |
---|---|---|
PagingPredicate | Initializes a new instance of the PagingPredicate class | |
PagingPredicate(Int32, IPredicate, IComparerKeyValuePairObject, Object) |
Creates a Paging predicate with provided page size and optional predicate and comparer.
|
Properties
Name | Description | |
---|---|---|
Comparer | IComparer<KeyValuePair<object, object>>> implementation used to sort the result on client side.
| |
IterationType |
Iteration type this paging predicate: One of Key, Value or Entry
| |
Page |
Current page index
| |
PageSize |
Page size of each iteration
|
Methods
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
GetFactoryId | ||
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetId | ||
GetNearestAnchorEntry |
After each query, an anchor entry is set for that page. SetAnchor``2(Int32, UMP, UMP)
For the next query user may set an arbitrary Page.
for example: user queried first 5 pages which means first 5 anchor is available
if the next query is for the 10th page then the nearest anchor belongs to page 5
but if the next query is for the 3nd page then the nearest anchor belongs to page 2
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
NextPage |
sets the page value to next page
| |
PreviousPage |
sets the page value to previous page
| |
ReadData | ||
Reset |
resets for reuse
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
WriteData |
Extension Methods
Name | Description | |
---|---|---|
And | (Defined by PredicateExt.) | |
Not | (Defined by PredicateExt.) | |
Or | (Defined by PredicateExt.) |
Remarks
Examples
Predicate lessEqualThanFour = Predicates.IsLessThanOrEqual("this", 4); // We are constructing our paging predicate with a predicate and page size. In this case query results fetched two by two. PagingPredicate predicate = new PagingPredicate(lessEqualThanFour, 2); // we are initializing our map with integers from 0 to 10 as keys and values. IMap map = hazelcastInstance.getMap("myMap"); for (int i = 0; i < 10; i++) { map.Put(i, i); } //invoking the query var values = map.Values(predicate); Console.WriteLine("values = " + values); // will print 'values = [0, 1]' predicate.NextPage(); // we are setting up paging predicate to fetch next page in the next call. values = map.Values(predicate); Console.WriteLine("values = " + values);// will print 'values = [2, 3]' var anchor = predicate.GetAnchor(); Console.WriteLine("anchor -> " + anchor); // will print 'anchor -> 1=1', since the anchor is the last entry of the previous page. predicate.previousPage(); // we are setting up paging predicate to fetch previous page in the next call values = map.Values(predicate); Console.WriteLine("values = " + values) // will print 'values = [0, 1]'
See Also