I am working with asp.net mvc and i am trying to get acces to a object that is in the cache.
In the Application_Start() of Global.asax.cs i create and store an object in the cache like this:
Translator translator = new Translator();
HttpContext.Current.Cache.Insert("Translator", translator, null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration);
Translator holds a dictionary with translations.
Now i want acces to this object from the cache to use functions and get values from the dictionary.
How can i do this?
I know i can acces it like this HttpContext.Current.Cache.Get("Translator") or Cache.Get("Translator") in the views
But how can i use the functions of the object ? The meaning of the cache is to have a object that is accesable througout the webapp right ?
Do i have to make an object and asses the value of the Cache.Get("Translator") to it, so i can use the functions or is there another solution?
View Complete Post