/// <summary> /// Constructor /// </summary> /// <param name="cacheRefreshTimeSpan"></param> /// <param name="basicCrud"></param> public MemoryCache(TimeSpan cacheRefreshTimeSpan, IBasicCrud basicCrud) { // Set the basic crud _basicCrud = basicCrud; var result = _basicCrud.GetAll().Result; // Initialize the data-store _dataStore = result.ToDictionary(x => x.Key, x => x.Value.Key); // Initialize the life times dictionary _lifeTimes = result.ToDictionary(x => x.Key, x => x.Value.Value); // Set the cache handler last ran _lastRun = DateTime.Now; // Cache refresher task _cacheRefresher = new Timer(e => DataStoreRefreshHandler(), null, cacheRefreshTimeSpan, cacheRefreshTimeSpan); }
public override async Task <IEnumerable <Stream> > GetAll() { return((await _streamDal.GetAll()).Where(x => x.User.Id == _user.Id).ToList()); }
public override async Task <IEnumerable <FtpSink> > GetAll() { return((await _ftpSinkDal.GetAll()).Where(x => x.User.Id == _user.Id).ToList()); }