daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Jul 18th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private static string CACHE_PBP_BABU_KEY = "PBP_BaBus";
  2. private static ICacheManager cache = CacheFactory.GetCacheManager();
  3.  
  4. public IList allBabus {
  5.             get
  6.             {
  7.                 if (!cache.Contains(CACHE_PBP_BABU_KEY) || cache[CACHE_PBP_BABU_KEY] == null)
  8.                 {
  9.                     RefreshComponentsListInCache();
  10.                 }
  11.  
  12.                 return (IList)cache[CACHE_PBP_BABU_KEY];
  13.  
  14.             }
  15.             set
  16.             {
  17.                 // Set is only used to clear the cache!
  18.                 cache.Remove(CACHE_PBP_BABU_KEY);
  19.             }
  20.         }
  21.  
  22.         public void RefreshComponentsListInCache()
  23.         {
  24.             // Get list from DB and store in cache
  25.             cache.Add(CACHE_PBP_BABU_KEY, GetComponents(), CacheItemPriority.Low, null, new AbsoluteTime(TimeSpan.FromMinutes(GenericConfiguration.CacheExpirationMinutes)));
  26.         }
  27.  
  28.         private IList GetComponents()
  29.         {
  30.             // Get everything from database and map it to lightobjects
  31.             IList test = OrganisationManager.GetAllBaBus();
  32.             return Mapper.Map<IList, IList>(test);
  33.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top