Alachisoft NCache 4.1 - Online Documentation

Entity Framework Caching Integration Modes

NOTE: This feature is not available in NCache Express and Professional edition.
Entity Framework Caching provider works under two modes. It can either be in "Caching" mode (caching the results of queries) or in "Analysis" mode (analyzing the queries). Provider can not work in both modes at the same time. Details of both the modes are given below:
Caching Mode:
It uses NCache for caching results of all queries that are executed on a database. Whenever update is detected (either UPDATE, INSERT or DELETE) in a respective database, the provider invalidates affected cache entries by evicting all cached queries which were dependent on any of the updated tables. Caching mode is further divided into two policies:
  1. Custom Caching: It includes user-configurable list of queries and cache the results of those queries only.
  2. CacheAll Caching: It caches all queries results.
Caching mode works on the following principles:
  • Only SELECT statements and stored procedures results will be cached.
  • If a SELECT statement or stored procedure do not yield any result, nothing will be cached.
  • User are supposed to select the target database that will be used to create database dependency. If no target database is selected, no database-dependency will be added.
  • Caching policies will be read from configuration file, when caching is started. If configuration file is updated, new policies will be applied for subsequent requests.
  • The provider will only cache those results which will be completely retrieved by the application. If query yielded more data then the application has read, before calling DbDataReader.Close(), nothing will be cached.
    Analysis Mode:
    This mode is used for monitoring the number of times each query executes and generates a result. This is a pass-through mode, no caching is done at this mode. In analysis phase following information will be collected:
  1. Query text: Select query.
  2. Call count: The number of times a query is called.
    Analysis mode works on the following principles:
  • Analysis can be started by changing the mode in configuration file from caching to analysis . During analysis mode, no result will be cached.
  • One analysis report will be generated on the following path: Default = <install-dir>/log-files/efcaching-logs/
  • Analysis report will be generated on the following conditions: When mode is changed.
  • When analysis time is over.
  • When application shutdown.
  • Analysis report will be generated in the following format:
    <!--Call-count = 21-->
    <query query-text = "" ["SELECT FROM Products"] | [stored-procedure-name = ""]
    caching = "true"
    expiration-type = "absolute"| sliding = ""
    expiration-time = "180"
    dbsyncdependency = "true"/>
  • The analysis report is similar as the custom policy syntax which will ease the user to use the same report in custom policy section.
  • The queries generated in the analysis report will be sorted in descending order of call-count, so that the least used queries will be listed at the end of the report. This will make it easier for user to copy a group of most frequently used queries and paste them in custom policy section.
See Also
Copyright © 2005-2012 Alachisoft. All rights reserved.