Created
July 31, 2008 17:32
-
-
Save ebello/3485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public delegate BaseGenericList<T> MethodExecution<T>(); | |
public static BaseGenericList<T> GetCachedList<T>(string key, object[] argsKey, MethodExecution<T> method) | |
{ | |
BaseGenericList<T> list = new BaseGenericList<T>(); | |
T[] listarray = (T[])CacheConfig.DeCache(key, argsKey); | |
if (listarray == null) | |
{ | |
list = method(); | |
CacheConfig.EnCache(key, list.ToArray(), argsKey); | |
} | |
else | |
{ | |
list.AddRange(listarray); | |
} | |
return list; | |
} | |
// calling | |
BaseGenericList<Event> eventlist = CacheConfig.GetCachedList<Event>("EventsList", new object[] { GroupID, start, end, start_index, max_results }, delegate() { return iobj.GetEvents(GroupID, start, end, start_index, max_results, out temp_total_results); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment