Пример #1
0
        public static void Loop(MemCache cache)
        {
            var i = 0;

            while (++i < 100)
            {
                var keys = new string[] { "A", "B", "C" };
                foreach (var key in keys)
                {
                    var value = cache.Get(key);
                    Console.WriteLine("GET {0}={1}", key, value);
                }

                Thread.Sleep(1000);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            cache = new MemCache(Update);
            cache.Add("B", 0, 2);
            cache.AddImmediate("A", false);
            cache.AddOnce("C", "INITIAL_VALUE");

            var keys = new string[] { "A", "B", "C" };

            foreach (var key in keys)
            {
                var value = cache.Get(key);
                Console.WriteLine("INIT {0}={1}", key, value);
            }

            Task.Run(() => { Loop(cache); });

            Console.ReadLine();
        }