当前位置: 首页>>代码示例>>C#>>正文


C# MemcachedClient.GetOld方法代码示例

本文整理汇总了C#中MemcachedClient.GetOld方法的典型用法代码示例。如果您正苦于以下问题:C# MemcachedClient.GetOld方法的具体用法?C# MemcachedClient.GetOld怎么用?C# MemcachedClient.GetOld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MemcachedClient的用法示例。


在下文中一共展示了MemcachedClient.GetOld方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MultigetSpeedTest

        private static void MultigetSpeedTest()
        {
            //Enyim.Caching.LogManager.AssignFactory(new ConsoleLogFactory());
            var tmc = new MemcachedClientConfiguration();

            tmc.AddServer("172.16.203.2:11211");
            tmc.AddServer("172.16.203.2:11212");
            //tmc.AddServer("172.16.203.2:11213");
            //tmc.AddServer("172.16.203.2:11214");

            tmc.Protocol = MemcachedProtocol.Binary;
            //tmc.SocketPool.MinPoolSize = 1;
            //tmc.SocketPool.MaxPoolSize = 1;

            tmc.SocketPool.ReceiveTimeout = new TimeSpan(0, 0, 4);
            tmc.SocketPool.ConnectionTimeout = new TimeSpan(0, 0, 4);

            tmc.KeyTransformer = new DefaultKeyTransformer();

            var tc = new MemcachedClient(tmc);
            const string KeyPrefix = "asdfghjkl";

            var val = new byte[10 * 1024];
            val[val.Length - 1] = 1;

            for (var i = 0; i < 100; i++)
                if (!tc.Store(StoreMode.Set, KeyPrefix + i, val))
                    Console.WriteLine("Fail " + KeyPrefix + i);

            var keys = Enumerable.Range(0, 500).Select(k => KeyPrefix + k).ToArray();

            Console.WriteLine("+");

            var sw = Stopwatch.StartNew();
            //tc.Get(KeyPrefix + "4");
            //sw.Stop();
            //Console.WriteLine(sw.ElapsedMilliseconds);

            //sw = Stopwatch.StartNew();

            //var p = tc.Get2(keys);

            //sw.Stop();
            //Console.WriteLine(sw.ElapsedMilliseconds);

            //sw = Stopwatch.StartNew();

            //var t = tc.Get(keys);
            //Console.WriteLine(" --" + t.Count);

            //sw.Stop();
            //Console.WriteLine(sw.ElapsedMilliseconds);

            //Console.WriteLine("Waiting");
            //Console.ReadLine();

            //return;

            for (var i = 0; i < 100; i++)
            {
                const int MAX = 300;

                sw = Stopwatch.StartNew();
                for (var j = 0; j < MAX; j++) tc.Get(keys);
                sw.Stop();
                Console.WriteLine(sw.ElapsedMilliseconds);

                sw = Stopwatch.StartNew();
                for (var j = 0; j < MAX; j++) tc.GetOld(keys);
                sw.Stop();
                Console.WriteLine(sw.ElapsedMilliseconds);

                //sw = Stopwatch.StartNew();
                //for (var j = 0; j < MAX; j++)
                //    foreach (var k in keys) tc.Get(k);
                //sw.Stop();
                //Console.WriteLine(sw.ElapsedMilliseconds);

                Console.WriteLine("----");
            }

            Console.ReadLine();
            return;
        }
开发者ID:thaingo,项目名称:EnyimMemcached,代码行数:84,代码来源:Program.cs


注:本文中的MemcachedClient.GetOld方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。