public LockerReloader(ILockerRetrieval lockerRetrieval, ICacheClient cacheClient, ICacheLock cacheLock, IUserTokenCache userTokenCache) { _lockerRetrieval = lockerRetrieval; _cacheClient = cacheClient; _cacheLock = cacheLock; _userTokenCache = userTokenCache; }
private static ICache <TKey, TValue> MRU <TKey, TValue>(ICacheLock cacheLock, int totalCapacity) { return(new Cache <TKey, TValue>( MRU_Policy <TKey, TValue>(), cacheLock, totalCapacity)); }
/// <summary> /// Ensure that lock cannot be obtained by other threads. /// </summary> /// <param name="getLock">Get lock function.</param> /// <param name="sharedLock">Shared lock.</param> private static void EnsureCannotLock(Func <ICacheLock> getLock, ICacheLock sharedLock) { var task = new Task(() => { Assert.IsFalse(sharedLock.TryEnter()); Assert.IsFalse(sharedLock.TryEnter(TimeSpan.FromMilliseconds(100))); using (var otherLock = getLock()) { Assert.IsFalse(otherLock.TryEnter()); Assert.IsFalse(otherLock.TryEnter(TimeSpan.FromMilliseconds(100))); } }); task.Start(); task.Wait(); }
public DataCache(ICacheStore cacheStore, ICacheLock locker, ICacheTimePolicy cacheTimePolicy) { _CacheStore = cacheStore; _CacheTimePolicy = cacheTimePolicy; _Locker = locker; }
public Cache(ICachePolicy <TKey, TValue> policy, ICacheLock cacheLock, long totalCapacity) { this.policy = policy; this.cacheLock = cacheLock; this.totalCapacity = totalCapacity; }
private static ICache <TKey, TValue> LRU <TKey, TValue>(IDictionary <TKey, ICacheEntry <TKey, TValue> > entries, ICacheLock cacheLock, int totalCapacity) { return(new Cache <TKey, TValue>( LRU_Policy <TKey, TValue>(), cacheLock, totalCapacity)); }
public ReadWriteCache(ICacheLock locker) { _asyncReaderWriterLock = locker; }