public FetchTilesHandler(IStore store, IPocket pocket, ITileMakerClient client, IOptions <PocketOptions> options)
     : base(store)
 {
     _pocket          = pocket;
     _tileMakerClient = client;
     _pocketOptions   = Guard.Against.Null(options, nameof(options)).Value;
 }
Esempio n. 2
0
        public async Task <List <PocketEntry> > GetEntriesAsync(IPocketOptions options)
        {
            Guard.Against.Null(options, nameof(options));
            Guard.Against.Null(options.Uri, nameof(options.Uri));
            Guard.Against.Default(() => options.CachingTimeSpan);

            return(await
                   _memoryCache.GetOrCreateAsync(CacheKeys.GetPocketFeedKey, async entry =>
            {
                entry.AbsoluteExpirationRelativeToNow = options.CachingTimeSpan;
                return await _feed.GetFeedAsync(options.Uri !, item => item.ToPocketEntry(), p => p.PubDate);
            }));
        }