Tag Info

New answers tagged


I would say no. A singleton is rarely the answer. If you dont believe do a quick search on singleton anti pattern. The main problem being that it is hard to unit test code which uses a singleton. A much more flexible approach is the inversion of control pattern. Basically you would would just make the class that would use your cache depend a IDataPoint ...


You can use Memory Cache. I use memory cache to cache data rarely changes or at the specific time. Here is example: public static T GetCache<T>(string key, Func<T> initializer) where T : new() { if (!MemoryCache.Default.Contains(key)) { try { T data = initializer(); AddData(key, data); return ...

Top 50 recent answers are included