Namespace: Nemiro.Data.Sql
Assembly: Nemiro.Data (in Nemiro.Data.dll) Version: 2.11.4.126 (2.11.4.126)
Assembly: Nemiro.Data (in Nemiro.Data.dll) Version: 2.11.4.126 (2.11.4.126)
Syntax
Property Value
Type: StringRemarks
Use the configuration file for this setting.
<appSettings> <clear /> <!--Cache type--> <add key="NeData:Sql:CacheType" value="File" /> <!--Cache path--> <add key="NeData:Sql:CachePath" value="C:\cache\MyApplication" /> </appSettings>
If the specified directory does not exist, it is created automatically.
When using the file cache in projects ASP. NET, ensure that the application and the IIS user have access for write and for modify the contents of a directory CachePath.
Examples
using (SqlClient client = new SqlClient()) { client.CacheDuration = 1200; // 20 minutes client.CacheType = CachingType.File; client.CachePath = @"C:\cache\MyApplication"; client.CommandText = "SELECT * FROM users"; var table = client.GetTable(); Console.WriteLine("Rows: {0}", table.Rows.Count); Console.WriteLine("Query execution time: {0}", client.LastQueryTime); Console.WriteLine("From cache: {0}", client.LastQueryResultsFromCache); }
See Also