public InMemoryCacheProvider( IInMemoryCaching caching, IOptions <InMemoryOptions> options) { _caching = caching; _options = options.Value; }
/// <summary> /// Initializes a new instance of the <see cref="T:EasyCaching.InMemory.DefaultInMemoryCachingProvider"/> class. /// </summary> /// <param name="name">Name.</param> /// <param name="cache">Cache.</param> /// <param name="options">Options.</param> /// <param name="factory">Distributed lock factory</param> /// <param name="loggerFactory">Logger factory.</param> public DefaultInMemoryCachingProvider( string name, IEnumerable <IInMemoryCaching> cache, InMemoryOptions options, IDistributedLockFactory factory = null, ILoggerFactory loggerFactory = null) : base(factory, options) { this._name = name; this._cache = cache.Single(x => x.ProviderName == _name); this._options = options; this._logger = loggerFactory?.CreateLogger <DefaultInMemoryCachingProvider>(); this._cacheStats = new CacheStats(); this.ProviderName = _name; this.ProviderType = CachingProviderType.InMemory; this.ProviderStats = _cacheStats; this.ProviderMaxRdSecond = _options.MaxRdSecond; this.IsDistributedProvider = false; _info = new ProviderInfo { CacheStats = _cacheStats, EnableLogging = options.EnableLogging, IsDistributedProvider = IsDistributedProvider, LockMs = options.LockMs, MaxRdSecond = options.MaxRdSecond, ProviderName = ProviderName, ProviderType = ProviderType, SerializerName = options.SerializerName, SleepMs = options.SleepMs, CacheNulls = options.CacheNulls, }; }
/// <summary> /// Initializes a new instance of the <see cref="T:EasyCaching.InMemory.DefaultInMemoryCachingProvider"/> class. /// </summary> /// <param name="cache">Cache.</param> /// <param name="options">Options.</param> /// <param name="loggerFactory">Logger factory.</param> public DefaultInMemoryCachingProvider( IInMemoryCaching cache, IOptionsMonitor <InMemoryOptions> options, ILoggerFactory loggerFactory = null) { this._cache = cache; this._options = options.CurrentValue; this._logger = loggerFactory?.CreateLogger <DefaultInMemoryCachingProvider>(); //this._cacheKeys = new ConcurrentCollections.ConcurrentHashSet<string>(); this._cacheStats = new CacheStats(); //this._name = EasyCachingConstValue.DefaultInMemoryName; }
/// <summary> /// Initializes a new instance of the <see cref="T:caching.InMemory.DefaultInMemoryCachingProvider"/> class. /// </summary> /// <param name="name">Name.</param> /// <param name="cache">Cache.</param> /// <param name="options">Options.</param> /// <param name="loggerFactory">Logger factory.</param> public DefaultInMemoryCachingProvider( string name, IEnumerable <IInMemoryCaching> cache, InMemoryOptions options, ILoggerFactory loggerFactory = null) { this._name = name; this._cache = cache.Single(x => x.ProviderName == _name); this._options = options; this._logger = loggerFactory?.CreateLogger <DefaultInMemoryCachingProvider>(); this._cacheStats = new CacheStats(); this.ProviderName = _name; this.ProviderStats = _cacheStats; this.ProviderType = _options.CachingProviderType; this.ProviderMaxRdSecond = _options.MaxRdSecond; this.ProviderOrder = _options.Order; this.IsDistributedProvider = false; }
/// <summary> /// Initializes a new instance of the <see cref="T:EasyCaching.InMemory.DefaultInMemoryCachingProvider"/> class. /// </summary> /// <param name="cache">Cache.</param> /// <param name="options">Options.</param> /// <param name="loggerFactory">Logger factory.</param> public DefaultInMemoryCachingProvider( IInMemoryCaching cache, IOptionsMonitor <InMemoryOptions> options, ILoggerFactory loggerFactory = null) { this._cache = cache; this._options = options.CurrentValue; this._logger = loggerFactory?.CreateLogger <DefaultInMemoryCachingProvider>(); this._cacheStats = new CacheStats(); //this._name = EasyCachingConstValue.DefaultInMemoryName; this.ProviderName = _name; this.ProviderStats = _cacheStats; this.ProviderType = _options.CachingProviderType; this.ProviderMaxRdSecond = _options.MaxRdSecond; this.ProviderOrder = _options.Order; this.IsDistributedProvider = false; }
public DefaultInMemoryCachingProvider(string name, IEnumerable <IInMemoryCaching> cachings) { ProviderName = name; _cache = cachings.FirstOrDefault(it => it.ProviderName == name); }