/// <summary>
 /// Initializes CacheCrow, creates a directory '_crow' in root if not present.
 /// </summary>
 /// <param name="size">Count of total entries in Active(in-memory) CacheCrow</param>
 /// <param name="activeCacheExpire">Milli-seconds before each entry in Active CacheCrow is expired</param>
 /// <param name="dormantCacheExpire">Milli-seconds before each entry in Dormant(disk) CacheCrow is expired</param>
 /// <param name="cleanerSnoozeTime">Milli-seconds before Cleaner cleans Dormant CacheCrow. Note: Cleaner is called after every cleanersnoozetime milli-seconds</param>
 /// <returns>Returns instance of ICacheCrow</returns>
 public static ICacheCrow <K, V> Initialize(int size = 1000, int activeCacheExpire = 300000, int dormantCacheExpire = 500000, int cleanerSnoozeTime = 400000)
 {
     if (_cache == null)
     {
         _cache = new CacheCrow <K, V>(size, activeCacheExpire, dormantCacheExpire, cleanerSnoozeTime);
     }
     _cache.LoadCache();
     return(_cache);
 }
Example #2
0
 /// <summary>
 /// Initializes CacheCrow and uses secondaryCache as the dormant cache.
 /// </summary>
 /// <param name="secondaryCache">Instance of ISecondaryCache></param>
 /// <param name="size">Count of total entries in Active(in-memory) CacheCrow</param>
 /// <param name="activeCacheExpire">Milli-seconds before each entry in Active CacheCrow is expired</param>
 /// <param name="cleanerSnoozeTime">Milli-seconds before Cleaner cleans Dormant CacheCrow. Note: Cleaner is called after every cleanersnoozetime milli-seconds</param>
 /// <returns>Returns instance of ICacheCrow</returns>
 public static ICacheCrow <K, V> Initialize(ISecondaryCache <K, V> secondaryCache, int size = 1000, int activeCacheExpire = 300000, int cleanerSnoozeTime = 400000)
 {
     if (_cache == null)
     {
         _cache = new CacheCrow <K, V>(size, activeCacheExpire, cleanerSnoozeTime, secondaryCache);
     }
     _cache.LoadCache();
     return(_cache);
 }