Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static string CACHE_PBP_BABU_KEY = "PBP_BaBus";
- private static ICacheManager cache = CacheFactory.GetCacheManager();
- public IList allBabus {
- get
- {
- if (!cache.Contains(CACHE_PBP_BABU_KEY) || cache[CACHE_PBP_BABU_KEY] == null)
- {
- RefreshComponentsListInCache();
- }
- return (IList)cache[CACHE_PBP_BABU_KEY];
- }
- set
- {
- // Set is only used to clear the cache!
- cache.Remove(CACHE_PBP_BABU_KEY);
- }
- }
- public void RefreshComponentsListInCache()
- {
- // Get list from DB and store in cache
- cache.Add(CACHE_PBP_BABU_KEY, GetComponents(), CacheItemPriority.Low, null, new AbsoluteTime(TimeSpan.FromMinutes(GenericConfiguration.CacheExpirationMinutes)));
- }
- private IList GetComponents()
- {
- // Get everything from database and map it to lightobjects
- IList test = OrganisationManager.GetAllBaBus();
- return Mapper.Map<IList, IList>(test);
- }
Add Comment
Please, Sign In to add comment