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