zoukankan      html  css  js  c++  java
  • C#缓存

    代码
     protected void Page_Load(object sender, EventArgs e)
            {
                ArrayList myarray 
    = new ArrayList();
                myarray.Add(
    "1.学习园地");
                myarray.Add(
    "2.交流论坛");
                myarray.Add(
    "3.帮助");
                
    //将数组添加到缓存中——使用Add方法
                Cache.Add("Category", myarray, null, DateTime.Now.AddSeconds(60), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Normal, null);
                myarray[
    1= "2.hello";
                Cache.Insert(
    "Catory", myarray);//使用insert方法修改缓存数据
                string tmpstr = "这是一个临时数据";
                Cache[
    "tmpdata"= tmpstr;
                Response.Write(Cache.Get(
    "tmpdata").ToString());//使用get方法获得缓存数据
                if (Cache["Category"].GetType().Name == "ArrayList")//用gettype()获取类型
                    Response.Write("类型是数组");
                IDictionaryEnumerator mycache 
    = Cache.GetEnumerator();//使用GetEnumerator遍历缓存中的数据
                while (mycache.MoveNext())
                {
                    Response.Write(mycache.Value 
    + "</br>");//这里读取出来是arraylist对象,要进行类型转换
                }
                Cache.Remove(
    "tmpdata");
                Response.Write(Cache.Count);
    //获取缓存中所有项的总数

            }
  • 相关阅读:
    JQuery中$.ajax()方法参数详解
    overload和override的区别
    linux 安装jdk和tomcat
    linux链接外网手动设置
    RISC与CISCCPU构架
    32位与64位内存区别
    system 系统调用、gcc编译过程
    c helloworld
    C语言中 有符号数、无符号数、整数溢出 (转)
    samba安装
  • 原文地址:https://www.cnblogs.com/yinpeng186/p/1939182.html
Copyright © 2011-2022 走看看