本文整理汇总了C#中CacheManager.Create方法的典型用法代码示例。如果您正苦于以下问题:C# CacheManager.Create方法的具体用法?C# CacheManager.Create怎么用?C# CacheManager.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheManager
的用法示例。
在下文中一共展示了CacheManager.Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BenchmarkTest
private static void BenchmarkTest()
{
Console.WriteLine("Benchmark test");
CacheManager cm = new CacheManager();
string conf = Path.Combine(Environment.CurrentDirectory, "DefaultCacheConfiguration.xml");
ICache cache = cm.Create("benchmark", conf);
DateTime time1 = DateTime.Now;
for (int i = 0; i < 10000000; i++)
{
cache[i] = i;
}
DateTime time2 = DateTime.Now;
Console.WriteLine("insert 10000000 items need " + (time2 - time1).ToString());
}
示例2: SimpleUsage
private static void SimpleUsage()
{
Console.WriteLine("Simple Usage");
CacheManager cm = new CacheManager();
string conf = Path.Combine(Environment.CurrentDirectory, "DefaultCacheConfiguration.xml");
ICache cache = cm.Create("simple", conf);
cache["key1"] = "value1";
cache["key2"] = 2;
cache[3] = "value3";
cache[4] = 4;
CacheValue value4 = cache[4];
int v4 = (int)value4.Content;
}