public ResourcesController( IResourcesService resourcesService, IInMemoryCache inMemoryCache) { _resourcesService = resourcesService; _inMemoryCache = inMemoryCache; }
public void SetUp() { _inMemoryCache = new InMemoryCache(); _cacheTimeSpan = TimeSpan.FromSeconds(2); _staleTimeSpan = TimeSpan.FromSeconds(1.5); _expiredTimeSpan = TimeSpan.FromSeconds(3); }
public AppDataController( IAppDataService appDataService, IStringsResourcesService stringsResourcesService, IInMemoryCache inMemoryCache) { _appDataService = appDataService; _stringsResourcesService = stringsResourcesService; _inMemoryCache = inMemoryCache; }
public GeolocationService( IHttpClientFactory httpClientFactory, ILoggerAdapter loggerAdapter, INyssWebConfig config, IInMemoryCache inMemoryCache) { _httpClientFactory = httpClientFactory; _loggerAdapter = loggerAdapter; _config = config; _inMemoryCache = inMemoryCache; }
public static async Task <Result <TResult> > GetCachedResult <TResult>(this IInMemoryCache memoryCache, string key, TimeSpan validFor, Func <Task <Result <TResult> > > value) where TResult : class { var cachedResult = memoryCache.Get <TResult>(key); if (cachedResult != null) { return(Success(cachedResult)); } var result = await value(); if (result.IsSuccess && result.Value != null) { memoryCache.Store(key, result.Value, validFor); } return(result); }
public ScoreController(IInMemoryCache memory) { _memory = memory; }
private CacheService(IInMemoryCache inmemorycacheService, SpCookie spCookie) { _inmemorycacheService = inmemorycacheService; _spCookie = spCookie; }