/// <summary> /// 測量讀取的時間 /// </summary> /// <param name="cache"></param> private static void MeasureGetTimeByRedisProtobuf(string cacheName, IDatabase cache) { System.Diagnostics.Stopwatch sh = new System.Diagnostics.Stopwatch(); sh.Start(); foreach (string key in redisManager.GetAllKeys()) { if (key.StartsWith("PF-")) { UserMenuInfo t = cache.GetProtobuf<UserMenuInfo>(key); } } sh.Stop(); Console.WriteLine(string.Format("CacheName:{0},Get-Milliseconds:{1}", cacheName, sh.ElapsedMilliseconds)); }