• Facebook
  • Twitter
  • Youtube
  • LinkedIn
  • RSS
  • Docs
  • Comparisons
  • Blogs
  • Try NCache
  • Contact Us
Try NCache
Show / Hide Table of Contents

Method ExecuteReader

ExecuteReader(QueryCommand, Boolean, Int32)

Performs search on the cache based on the query specified. Returns list of key-value pairs in a data reader which fulfills the query criteria. This key-value pair has cache key and its respective value. You can specify the flag for specifying if you want data with keys.

Declaration
ICacheReader ExecuteReader(QueryCommand queryCommand, bool getData = true, int chunkSize = -1)
Parameters
Type Name Description
QueryCommand queryCommand

QueryCommand containing query text and values.

System.Boolean getData

Flag to indicate whether the resulting values have to be returned with keys or not.

System.Int32 chunkSize

Size of data/keys packets received after search, default value is 512*1024 KB.

Returns
Type Description
ICacheReader

Reads forward-only stream of result sets of the query executed on cache.

Remarks

These operators are supported by NCache Queries.

  1. Comparison Operators = , == , != , <> , < , > , <=, >=, IN
  2. Logical Operators AND , OR , NOT
  3. Miscellaneous () , DateTime.Now , DateTime("any date time compatible string")
Examples
ICache cache = CacheManager.GetCache("demoCache");

Instead of Product, specify fully qualified name of your custom class.

string query = "SELECT Product where this.ProductName = ?";

QueryCommand queryCommand = new QueryCommand(query);
queryCommand.Parameters.Add("ProductName", "Chai");
queryCommand.Parameters.Add("UnitsInStock", 250);

try
{
    ICacheReader reader = cache.SearchService.ExecuteReader(queryCommand, true, 50);
    if (reader.FieldCount > 0)
    {
        while (reader.Read())
        {
            object category = reader.GetValue<object>(0);
            //perform operations
        }
    }
    else
    {
        //perform operations
    }
    reader.Close();
}

catch
{
    //handle exception
}

Contact Us

PHONE

+1 214-619-2601   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Try NCache
Pricing
NCache Playground

Deployments
  • Cloud
  • Docker
  • Kubernetes
  • On-Premises
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • SignalR Backplane
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Blogs
  • Foundations
  • Videos
  • Comparisons
  • Shows
  • Whitepapers
  • Articles
  • Tech Talks
  • Magazine Articles
  • Third-Party Articles
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Docs
  • Schedule a Demo
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Terms of Use
  •  
  • Privacy Policy
  •  
  • Cookie Policy
© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.
  • Facebook
  • Twitter
  • Youtube
  • LinkedIn
  • RSS