EFCaching Config
The EFCaching configuration file contains information regarding the Entity Framework provider. efcaching.ncconf is installed with NCache and is used for enabling NCache in Entity Framework applications. The configurations are stored in an efcaching.ncconf file.
Note
This file is located at %NCHOME%/config
in Windows or opt\ncache\config
in Linux.
EFCaching Config Tags
The EFCaching configuration file is explained below:
- Provider Configuration contains cache and caching policy-related information. Below are the changes required in efcaching.ncconf.
<configuration>
<app-config app-id = "PersonNameApp" mode = "analysis|caching">
app-id: Is an identifier for an application. The configuration can contain multiple configuration settings for different applications. App-id for efcaching.ncconf should be the same as in the application otherwise it will prompt an error.
Mode: Can either be "Analysis" or "Caching". (Hot Applicable). Default = 'Caching'
Analysis: mode is used for monitoring the number of times each query executes and then it generates a report. The report contains the Query text and the call count for each query. This report can be used in Custom policy. No caching is done in this mode.
<analysis-policy log-path = "" analysis-time = "60" cache-enable-threshold = "5" default-expiration-type = "absolute|sliding" default-expiration-time = "180" dbsyncdependency = "true"/>
Log-path: Path at which analysis log files will be generated. Default =
<InstallDir>/log-files/efcaching-analysis-logs/
Analysis-time: The time for which the analysis will run. Default = 60 min
Cache-enable-threshold: Caching will automatically be enabled for queries whose call-count exceeds this threshold. Default = 5
Default-expiration-type: Default expiration type for analyzed queries. Default = absolute
Default-expiration-time: Default expiration time for analyzed queries. Default = 180 sec (3 min)
dbsyncdependency: Determine whether to enable database-dependency or not. Default = "true"
For "Caching" mode, the wrapping provider will cache the results of all the specified queries. This mode works on either a
cacheall
policy or acustom
policy. Both policies have their own specifications. Whenever an update is detected (either UPDATE, INSERT, or DELETE) in their respective database, the provider invalidates the affected cache entries by evicting all cached queries that were dependent on any of the updated tables.
<cache-policy-configuration database = "none|oracle10i2|sqlserver" cache-id ="mycache">
Database: Database information is collected to create a database sync dependency. (Hot Applicable). Default =
'none'
Cache-id: Name of the cache. Default =
'mycache'
For
cache
policy, it caches all the queries and their results.
<cache-policy expiration-type = "absolute|sliding" enabled="True" expiration-time = "1800" dbsyncdependency ="true"/>
Expiration-type: The type of expiration, can be 'sliding' or 'absolute'. Default =
'absolute'
.Enabled: Determine whether the policy is in effect or not. (Hot Applicable). Default = 'true'
Expiration-time: Default = 180 sec (3 min)
dbsyncdependency: Determine whether to enable the database-dependency or not. Default =
'true'
For custom policy, it includes a user-configurable list of queries that should be cached with their results. When a custom policy is selected, only those query results will be cached for which the caching is enabled. You can also specify a custom caching policy for all queries.
<custom-policy>
<query query-text = "" ["SELECT FROM Products"] | stored-procedure-name = "" ] caching ="true" expiration-type = "absolute"| sliding = "" expiration-time = "180" dbsyncdependency ="true"/>
</custom-policy>
</cache-policy>
</app-config>
</configuration>
Query-text: Text of the query whose result is to be cached OR name of a stored procedure whose output is to be cached.
Caching: Determines whether caching is enabled for this query or not. Default =
'true'
Expiration-type: The type of expiration, can be 'absolute' or 'sliding'. Default =
'absolute'
.Expiration-time: Default = 180 sec (3 min)
dbsyncdependency: Determine whether to enable database-dependency for analyzed queries. Default = "
true
"In the case of stored procedures, query text will be the name of a stored procedure, and there will be no default policy or database sync dependency.
User can cache stored procedure result with expiration only, no database dependency is needed here.
See Also
Client Config
Server Side Configurations
Cache Server Settings
General Cache Settings