Beispiel #1
0
        /// <summary>
        /// 插入和读取字符串类型
        /// </summary>
        static void PutString()
        {
            RedisManager rm = new RedisManager();

            rm.InsertString <string>("mykey", " money");
            var value = rm.GetString("mykey");

            Console.WriteLine(value);
            //Console.ReadLine();
        }
Beispiel #2
0
        static void PutXmlString()
        {
            XDocument xDoc = XDocument.Load(new System.IO.StreamReader("dt_sample.xml"));
            string    s    = xDoc.ToString();

            RedisManager rm = new RedisManager();

            rm.InsertString("myxmlstring", s);

            string sCached = rm.GetString("myxmlstring");

            //deleted
            rm.DeleteXElement("myxmlstring", 2);
            string sDel = rm.GetXDocument("myxmlstring").ToString();

            //inserted
            string insXml = "<DataSet><DataTable><DataRow><ID>2</ID><cod>P</cod><txt>涤</txt><supID>1</supID><suptxt>面料</suptxt><supcod>F</supcod><lvl>2</lvl><dir>1</dir></DataRow></DataTable></DataSet>";

            rm.SaveXElement("myxmlstring", 2, insXml);
            string sCachedIns = rm.GetXDocument("myxmlstring").ToString();
        }