Пример #1
0
 public ResourcesController(
     IResourcesService resourcesService,
     IInMemoryCache inMemoryCache)
 {
     _resourcesService = resourcesService;
     _inMemoryCache    = inMemoryCache;
 }
Пример #2
0
 public void SetUp()
 {
     _inMemoryCache   = new InMemoryCache();
     _cacheTimeSpan   = TimeSpan.FromSeconds(2);
     _staleTimeSpan   = TimeSpan.FromSeconds(1.5);
     _expiredTimeSpan = TimeSpan.FromSeconds(3);
 }
Пример #3
0
 public AppDataController(
     IAppDataService appDataService,
     IStringsResourcesService stringsResourcesService,
     IInMemoryCache inMemoryCache)
 {
     _appDataService          = appDataService;
     _stringsResourcesService = stringsResourcesService;
     _inMemoryCache           = inMemoryCache;
 }
Пример #4
0
 public GeolocationService(
     IHttpClientFactory httpClientFactory,
     ILoggerAdapter loggerAdapter,
     INyssWebConfig config,
     IInMemoryCache inMemoryCache)
 {
     _httpClientFactory = httpClientFactory;
     _loggerAdapter     = loggerAdapter;
     _config            = config;
     _inMemoryCache     = inMemoryCache;
 }
Пример #5
0
        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);
        }
Пример #6
0
 public ScoreController(IInMemoryCache memory)
 {
     _memory = memory;
 }
Пример #7
0
 private CacheService(IInMemoryCache inmemorycacheService, SpCookie spCookie)
 {
     _inmemorycacheService = inmemorycacheService;
     _spCookie = spCookie;
 }