Alachisoft NCache 4.1 - Online Documentation

Indexing Searchable Attributes in .NET

NOTE: This feature is not available in NCache Express and Professional edition.
NCache requires all searchable attributes to be indexed. This is because, without indexing, NCache would have to traverse the entire cache in order to find the items. That is a very costly operation with potential of slowing down the entire cache.
NCache provides its own indexing mechanism. You can identify the objects in your .NET assemblies that you want to index. NCache uses .NET Reflection to extract data from the indexed attributes and builds its internal index. Then, when you query the cache with cache.SearchCQ() and cache.SearchEntriesCQ(), NCache uses these indexes to quickly find the desired objects and returns them to you.
Defining Indexes
NCache Manager provides a user friendly interface for defining indexes. Following example demonstrates procedure of defining indexes on attributes.
Suppose that cache contains Person object where the definition of Person is as below:
public class Person
public string CustomerID;
public int Age;
public Person(string id, int age)
this.CustomerID = id;
this.Age = age;
Follow these steps to define indexes for the attributes of Person:
  • Stop the Cache if it is running.
  • From the tabbed view, select 'Query Indexes' tab as shown in the figure below.
  • Click 'Add' button from the Query Indexes tab, you'll see the 'Select Query Indices' dialog. Click 'Browse' button to add assembly which contains the definition of the Person.
  • From the list of 'Selected Assemblies', select Person class and add it to the List of selected Classes using 'Add Class' button.
  • From the 'Select Query Indexes' dialog, mark the attribute(s) of the Person class that you want to be indexed.
  • Press 'OK' to complete the process.
  • The following screen appears, showing the attributes selected for the indexing.
See Also

Copyright © 2005-2012 Alachisoft. All rights reserved.