示例#1
0
 public async Task <T> GetAsync <T>(string key, VariableAttribute attr)
 {
     try
     {
         return(await _dataCache.RetrieveData <T>(
                    key,
                    attr.ExpirationTime > 0?(TimeSpan?)TimeSpan.FromSeconds(attr.ExpirationTime) : null));
     }
     catch (DataExpiredException)
     {
         return(default);
示例#2
0
        public async Task <List <HistoryFeedEntry> > GetHistory(CrawlerSet set)
        {
            if (_historyDictionary.TryGetValue(set.Guid, out var history))
            {
                return(history);
            }

            history = await _dataCache.RetrieveData <List <HistoryFeedEntry> >($"{HistoryDirectory}/{set.Guid}");

            if (history != null)
            {
                _historyDictionary[set.Guid] = history;
            }

            return(history);
        }
示例#3
0
 public static async Task <T> RetrieveData <T>(string filename, string originFolder, int expiration)
 {
     return(await DataCacheService.RetrieveData <T>(filename, originFolder, expiration));
 }