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: Int64Remarks
The buffer is used only if the property CacheType value has File.
You can use configuration file for this setting.
<appSettings> <clear /> <!--Cache type--> <add key="NeData:Sql:CacheType" value="File" /> <!--Cache storage--> <add key="NeData:Sql:CachePath" value="C:\cache\MyApplication" /> <!--Memory buffer size 50 Mb (50 Mb * (1 Mb = 1024 Kb) = 51 200 Kb)--> <add key="NeData:Sql:CacheBufferSize" value="51200" /> </appSettings>
Examples
using (SqlClient client = new SqlClient()) { client.CacheDuration = 1200; // 20 minutes * 60 seconds = 1 200 seconds client.CacheType = CachingType.File; // memory buffer size - 100 Mb client.CacheBufferSize = 102400; // build query client.CommandText = "SELECT * FROM users"; // execution query var table = client.GetTable(); // output Console.WriteLine("Rows: {0}", table.Rows.Count); Console.WriteLine("Query execution time: {0}", client.LastQueryTime); Console.WriteLine("From cache: {0}", client.LastQueryResultsFromCache); }
See Also