Пример #1
0
        public static void Run()
        {
            CacheManager.Init(System.Reflection.Assembly.GetExecutingAssembly());

            string p1 = "foo";
            string p2 = "bar";

            while (true)
            {
                var result = CacheManager.Execute(Demo2DataLayer.GetData, Demo2CacheKeysRegister.Items.DATA_LAYER__GET_DATA);

                var result2 = CacheManager.Execute(() =>
                {
                    return(Demo1DataLayer.GetWithParameter(p1, p2));
                }, Demo2CacheKeysRegister.Items.DATA_LAYER__GET_DATA_WITH_PARAMETERS.Format(p1, p2));

                Console.WriteLine("GetData: " + result);
                Console.WriteLine("GetWithParameter: " + result2);

                Console.ReadKey();
            }
        }
Пример #2
0
        public static void Run()
        {
            CacheManager.Init(System.Reflection.Assembly.GetExecutingAssembly());

            string p1 = "foo";
            string p2 = "bar";

            while (true)
            {
                var result = CacheManager.Execute(Demo1DataLayer.GetData, "GetData");

                var result2 = CacheManager.Execute(() =>
                {
                    return(Demo1DataLayer.GetWithParameter(p1, p2));
                }, "GetWithParameter" + string.Format("-{0}-{1}", p1, p2));

                Console.WriteLine("GetData: " + result);
                Console.WriteLine("GetWithParameter: " + result2);

                Console.ReadKey();
            }
        }