public void New_Arguments_Not_Allow_Null_Or_White_Space(string cacheIndicator, string optionsIndicator) { Microsoft.Extensions.Caching.Memory.IMemoryCache cache = cacheIndicator == null ? null : new FoobarCache(); var options = optionsIndicator == null ? null : new Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions(); Assert.Throws <ArgumentNullException>(() => new Memory.MemoryCache("foo", cache, options)); }
/// <summary> /// Loads the specified local cache. /// </summary> /// <param name="_localCache">The local cache.</param> /// <param name="dbAllPageUrlRepository">The database all page URL repository.</param> /// <param name="dbPageUrlRepository">The database page URL repository.</param> /// <param name="restoresstyle">The restoresstyle.</param> public static void Load(IMemoryCache _localCache, IAllPageURLRepository dbAllPageUrlRepository, IPageURLRepository dbPageUrlRepository, RestoreStoreStyleEnum restoresstyle) { if (restoresstyle == RestoreStoreStyleEnum.File) { if (File.Exists(@"storevalues.json")) { List <PageURL> _allKeys = JsonConvert.DeserializeObject <List <PageURL> >(File.ReadAllText(@"storevalues.json")); _localCache.Set("AllKeys", _allKeys); } } if (restoresstyle == RestoreStoreStyleEnum.Db) { var _allKeys = dbAllPageUrlRepository.GetAllPageURL().Result; _localCache.Set("AllKeys", _allKeys); if (_allKeys != null) { if (_allKeys.AllUrls != null) { _allKeys.AllUrls.ForEach(item => { _localCache.Set(item.ShortURL, item); }); } } } }
public ReportViewerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IWebHostEnvironment hostingEnvironment) #endif { _cache = memoryCache; _hostingEnvironment = hostingEnvironment; }
public QueryProcessor( ILogger <QueryProcessor> logger, IServiceProvider serviceProvider, Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache) { _logger = logger; _serviceProvider = serviceProvider; _memoryCache = memoryCache; }
//todo context /// <summary> /// Initializes a new instance of the <see cref="HomeController"/> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="urlcache">The urlcache.</param> /// <param name="repository">The repository.</param> /// <param name="allrepository">The allrepository.</param> /// <param name="configuration">The configuration.</param> public HomeController(ILogger <HomeController> logger, IMemoryCache urlcache, IPageURLRepository repository, IAllPageURLRepository allrepository, IConfiguration configuration) { _logger = logger; _localCache = urlcache; _repository = repository; _allrepository = allrepository; _configuration = configuration; _persistentStore = Enum.Parse <RestoreStoreStyleEnum> (_configuration.GetValue <string>("PersistentReStore")); }
public CommandBus( ILogger <CommandBus> logger, IServiceProvider serviceProvider, IAggregateStore aggregateStore, Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache) { _logger = logger; _serviceProvider = serviceProvider; _aggregateStore = aggregateStore; _memoryCache = memoryCache; }
public ReportDesignerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IWebHostEnvironment hostingEnvironment) #endif { _cache = memoryCache; _hostingEnvironment = hostingEnvironment; ExternalServer externalServer = new ExternalServer(_hostingEnvironment); this.ServerURL = "Sample"; externalServer.ReportServerUrl = this.ServerURL; ReportDesignerHelper.ReportingServer = this.Server = externalServer; }
public DispatchToEventSubscribers( ILogger <DispatchToEventSubscribers> logger, IServiceProvider serviceProvider, ISetup setup, Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache) { _logger = logger; _serviceProvider = serviceProvider; _setup = setup; _memoryCache = memoryCache; }
//todo: add lookup for cached data first? public Repository() { _memoryCache = new MemoryCache(new MemoryCacheOptions() { }); var dbPath = Path.Combine(Environment.CurrentDirectory, "rep"); if (!Directory.Exists(dbPath)) { Directory.CreateDirectory(dbPath); } _dbFilePath = Path.Combine(dbPath, "myDb.db"); }
public PeerMessageCorrelationManager(IReputationManager reputationManager, IMemoryCache cache, ILogger logger, IChangeTokenProvider changeTokenProvider, IScheduler scheduler = null) : base(cache, logger, changeTokenProvider) { var streamScheduler = scheduler ?? Scheduler.Default; _reputationEvent = new ReplaySubject <IPeerReputationChange>(0, streamScheduler); ReputationEventStream = _reputationEvent.AsObservable(); _evictionEvent = new ReplaySubject <KeyValuePair <ICorrelationId, PeerId> >(0, streamScheduler); EvictionEventStream = _evictionEvent.AsObservable(); reputationManager.MergeReputationStream(ReputationEventStream); }
/// <summary> /// Stores the specified local cache. /// </summary> /// <param name="_localCache">The local cache.</param> /// <param name="storestyle">The storestyle.</param> /// <param name="alldatabase">The alldatabase.</param> /// <param name="database">The database.</param> public static void Store(IMemoryCache _localCache, RestoreStoreStyleEnum storestyle, IAllPageURLRepository alldatabase, IPageURLRepository database) { bool blanklist = true; var _allKeys = new AllPageUrls(); _localCache.TryGetValue("AllKeys", out _allKeys); if (storestyle == RestoreStoreStyleEnum.File) { using FileStream fs = File.Create("storevalues.json"); var _output = JsonConvert.SerializeObject(_allKeys.AllUrls); byte[] bytes = Encoding.UTF8.GetBytes(_output); fs.Write(bytes, 0, bytes.Length); } if (storestyle == RestoreStoreStyleEnum.Db) { var allDbkey = alldatabase.GetAllPageURL(); var allDbkeys = database.GetAllPageURL(); Guid originalId = Guid.NewGuid(); if (allDbkey.Result != null) { originalId = allDbkey.Result.Id; blanklist = false; } var Allkeys = new AllPageUrls() { Id = originalId, AllUrls = new List <PageURL>() }; Allkeys.AllUrls.AddRange(_allKeys.AllUrls); if (blanklist) { alldatabase.SetAllUrls(Allkeys); } else { alldatabase.Update(Allkeys); } } }
public CachedRoute( string controller, string action, ICachedRouteDataProvider <TPrimaryKey> dataProvider, Microsoft.Extensions.Caching.Memory.IMemoryCache cache, Microsoft.AspNetCore.Routing.IRouter target) { if (string.IsNullOrWhiteSpace(controller)) { throw new System.ArgumentNullException("controller"); } if (string.IsNullOrWhiteSpace(action)) { throw new System.ArgumentNullException("action"); } if (dataProvider == null) { throw new System.ArgumentNullException("dataProvider"); } if (cache == null) { throw new System.ArgumentNullException("cache"); } if (target == null) { throw new System.ArgumentNullException("target"); } _controller = controller; _action = action; _dataProvider = dataProvider; _cache = cache; _target = target; // Set Defaults CacheTimeoutInSeconds = 900; _cacheKey = "__" + this.GetType().Name + "_GetPageList_" + _controller + "_" + _action; }
public ClaimsCacheStore(Microsoft.Extensions.Caching.Memory.IMemoryCache cache) { this.cache = cache; }
public MemoryCache() { cache = new Microsoft.Extensions.Caching.Memory.MemoryCache(new Microsoft.Extensions.Caching.Memory.MemoryCacheOptions()); }
public MemoryCache(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache) { _memoryCache = memoryCache; }
public ReportDesignerController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IWebHostEnvironment hostingEnvironment) { _cache = memoryCache; _hostingEnvironment = hostingEnvironment; }
public TokenService(IConfiguration config, UserService userService, Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache) : base(config) { _userService = userService; _memoryCache = memoryCache; }
/// <summary> /// /// </summary> /// <param name="cache"></param> public InMemoryCache(c.IMemoryCache cache) { Cache = cache; }
public MemoryCacheAdapter(ms.IMemoryCache memoryCache) { _memoryCache = memoryCache; }
// Post action to process the report from server based json parameters and send the result back to the client. #if NETCOREAPP2_1 public ReportViewerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IHostingEnvironment hostingEnvironment)
public NoticiaService(ILogerApi logerApi, Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache) { _memoryCache = memoryCache; _log = logerApi; }
/// <summary> /// WeatherForecastController /// </summary> /// <param name="_weatherService"></param> /// <param name="_exceptionHelper"></param> public WeatherForecastController(IWeatherForecastService _weatherService, ExceptionHelper _exceptionHelper, IMemoryCache _memoryCache) { weatherService = _weatherService; exceptionHelper = _exceptionHelper; memoryCache = _memoryCache; }
public ResourcesManagerController(IHttpClientFactory clientFactory, Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache) { _cache = memoryCache; _clientFactory = clientFactory; }