示例#1
0
        /// <summary>
        /// Метод, возвращающий число Фибоначчи по порядковуму номеру
        /// </summary>
        /// <returns>int</returns>
        public int GetValueByNumber(int n, CacheType cacheType)
        {
            string key = String.Format("Fibonacci{0}", n);

            if (cacheType.Equals(CacheType.RedisCaching))
            {
                return(GetValueByNumberFromRedisCache(n, key));
            }
            else if (cacheType.Equals(CacheType.RuntimeCaching))
            {
                return(GetValueByNumberFromRuntimeCache(n, key));
            }

            return(0);
        }
示例#2
0
        private void OnExecute(CommandLineApplication app)
        {
            if (string.IsNullOrEmpty(CacheType))
            {
                app.ShowHelp();
                return;
            }

            if (Benchmark)
            {
                Console.WriteLine($"Running Benchmarks for {CacheType}!");
                BenchmarkSwitcher.FromAssembly(typeof(ConcurrentDictionaryCache).Assembly).Run(new string[] { DataFile });
            }
            else
            {
                if (CacheType.Equals("ParallelDictionary"))
                {
                    ConcurrentDictionaryCache pdc = new ConcurrentDictionaryCache(DataFile);
                    pdc.QueryCache();
                }
                else if (CacheType.Equals("FASTER"))
                {
                    Console.WriteLine($"Starting FASTER cache workload.");
                    throw new NotImplementedException();
                }
                else
                {
                    Console.WriteLine($"Undefined CacheType {CacheType}!");
                }
            }
        }