Example #1
0
        public static void test1()
        {
            var tmp = client.Get <Post>("a09590d8-2e98-46b0-a07f-00cfedd3aefd");

            Console.WriteLine(tmp == null?"fail":"ok");
            var newBeer = new Beer()
            {
                Name      = "Old Yankee Ale",
                ABV       = 5.00f,
                BreweryId = "cottrell_brewing",
                Style     = "American-Style Amber",
                Category  = "North American Ale"
            };
            var key = "cottrell_brewing-old_yankee_ale-demo2";

            try
            {
                var handler = new StoreHandler(client);
                //client.Remove(key);
                //var result = client.StoreJson(StoreMode.Set, key, newBeer);
                var result = handler.Set(key, newBeer);
                if (result.Success)
                {
                    Console.WriteLine("Cache store ok!");
                    Console.WriteLine(client.Get(key));
                    var cacheBeer = handler.Get(key); //client.GetJson<Beer>(key);
                    Console.WriteLine("Beer's Name:" + cacheBeer.Value);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #2
0
        public static void test1()
        {
            var tmp = client.Get<Post>("a09590d8-2e98-46b0-a07f-00cfedd3aefd");
            Console.WriteLine(tmp==null?"fail":"ok");
            var newBeer = new Beer()
            {
                Name = "Old Yankee Ale",
                ABV = 5.00f,
                BreweryId = "cottrell_brewing",
                Style = "American-Style Amber",
                Category = "North American Ale"

            };
            var key = "cottrell_brewing-old_yankee_ale-demo2";
            try
            {
                var handler = new StoreHandler(client);
                //client.Remove(key);
                //var result = client.StoreJson(StoreMode.Set, key, newBeer);
                var result = handler.Set(key, newBeer);
                if (result.Success)
                {
                    Console.WriteLine("Cache store ok!");
                    Console.WriteLine(client.Get(key));
                    var cacheBeer = handler.Get(key); //client.GetJson<Beer>(key);
                    Console.WriteLine("Beer's Name:" + cacheBeer.Value);

                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }