Alachisoft NCache 4.1 - Online Documentation

Indexing Attributes for LINQ

 
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 items. That is a very costly operation with potential of slowing down the entire cache.
 
NCache provides its own indexing mechanism through which you can identify objects in .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, NCache uses those 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 Customer object where the definition of Customer is as below:
 
[Serializable]
public class Customer
{
public string CustomerID;
public string Country;
public Customer(string id, string country)
{
this.CustomerID = id;
this.Country = country;
}
}
 
Follow the steps given below to define indexes for the attributes of Customer:
 
  • 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 Customer.
  • From the list of 'Selected Assemblies', select Customer 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 Customer class that you want to be indexed.
     
     
     
     
  • Press 'OK' button to finish the process.
  • The following screen appears, showing the attributes selected for the indexing.
     
     
     
 
 
 
See Also
 
Copyright © 2005-2012 Alachisoft. All rights reserved.