Caching not working
ASP.NET
2
Posts
2
Posters
0
Views
1
Watching
-
Below is the add and get cache methods; however, the get method doesn't return any value. I have insured that the key (sessionID) is valid when calling both. Can someone help?
public Object GetCacheItem(string key) { return HttpRuntime.Cache.Get(key); } public void AddCacheItem(string key, Object value) { HttpRuntime.Cache.Add(key, value, null, DateTime.Now.AddMinutes(20), Cache.NoSlidingExpiration, CacheItemPriority.Default, null); }
Thanks, Steve
-
Below is the add and get cache methods; however, the get method doesn't return any value. I have insured that the key (sessionID) is valid when calling both. Can someone help?
public Object GetCacheItem(string key) { return HttpRuntime.Cache.Get(key); } public void AddCacheItem(string key, Object value) { HttpRuntime.Cache.Add(key, value, null, DateTime.Now.AddMinutes(20), Cache.NoSlidingExpiration, CacheItemPriority.Default, null); }
Thanks, Steve
I only ever access the cache item like: object sessionObj = HttpRuntime.Cache[key]; 'Get' sounds like it would do the same but I'm not certain.
Mark Graham (MCP) // The Doodler blogging about C#, Asp.Net, and Design Patterns at: codeArch[^] and contributing at dotNet Notepad[^]