Creating Indexes Using a Coherence Function

Use the coherence function c_index to create index.

The indexing method applies to the Coherence cache provider only. It is not the preferred method. It is recommended that you use the method explained in Creating an Index Using a Domain Object Override Setting.

Procedure

  • You can create an ordered or unordered index using the following function in a startup rule function.

Result

C_Index(String cacheName, Object property, boolean isOrdered)

where:

cacheName is a String returned by C_CacheName().

property is the object returned by the appropriate C_DatatypeAtomGetter functions, for example, C_StringAtomGetter().

isOrdered is a Boolean: set to true to order the contents of the indexed information, and set to false if you want to use an unordered index.

For example:

String cacheName = Coherence.C_CacheName("/Customer");
Object getter = Coherence.Extractor.C_IntAtomGetter("age");
Coherence.C_Index(cacheName, getter, true);