![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
This may be a stupid question but... What's the difference between using the ASP.NET Cache object and a class that stores data in a static object. For example, the class below contains a hashtable declared statically. This hashtable is accessible by all objects that are part of the application. public class MyCache { private static Hashtable hashtable = new Hashtable(); public MyCache() { } public static Hashtable GetHashtable() { return hashtable; } } The data being accessible by code such as: string s = MyCache.GetHashtable()[ "CacheValue" ] as string; s = s == null ? String.Empty : s; this.TextBox1.Text = s; Surely this provides the same functionality as the built-in Cache object and, dare I say it, prefereable if you're wanting to write as environment agnostic component as possible i.e. the class will behave the same regardless of whether it is being called by a web/windows/console app. Any comments and/or protestations would be welcomed. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |