Caching in C#/.Net

前端 未结 12 1274
离开以前
离开以前 2020-11-30 02:22

I wanted to ask you what is the best approach to implement a cache in C#? Is there a possibility by using given .NET classes or something like that? Perhaps something like a

12条回答
  •  孤城傲影
    2020-11-30 02:48

    If you are looking to Cache something in ASP.Net then I would look at the Cache class. For example

    Hashtable menuTable = new Hashtable(); 
    menuTable.add("Home","default.aspx"); 
    Cache["menu"] = menuTable; 
    

    Then to retrieve it again

    Hashtable menuTable = (Hashtable)Cache["menu"];
    

提交回复
热议问题