forum

Home / DeveloperSection / Forums / How to Caching of Hashtable in MVC?

How to Caching of Hashtable in MVC?

Anonymous User352230-Oct-2014
I have a function, simple function from a public class.

That function creates an Hashtable object with information given from database, the part of his function like this:
try {
       while ( dataReader.Read() )
       {
           Hashtable table1= new Hashtable();
           Hashtable table2= new Hashtable();
 
           table1.Add( dataReader["field1"].ToString(), Localization.English(dataReader["field1"]);
 
           table2.Add( dataReader["field2"].ToString(), Localization.French(dataReader["field2"]);
        }
     }
catch ( Exception e )
{
    Console.WriteLine( e.Message );
}


I want to cache these two Hashtables and use them in other classes. As I know, I cannot use HttpRuntime.Cache even if I used System.Web namespace.

I saw that HttpRuntime.Cache could be used in Model class.

Are there other way to cache these Hashtables ?


Updated on 30-Oct-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By