public DefaultSQLiteCachingProvider(
            string name,
            IEnumerable <ISQLiteDatabaseProvider> dbProviders,
            SQLiteOptions options,
            ILoggerFactory loggerFactory = null)
        {
            this._dbProvider = dbProviders.Single(x => x.DBProviderName.Equals(name));
            this._options    = options;
            this._logger     = loggerFactory?.CreateLogger <DefaultSQLiteCachingProvider>();
            this._cache      = _dbProvider.GetConnection();
            this._cacheStats = new CacheStats();
            this._name       = name;

            this.ProviderName          = this._name;
            this.ProviderType          = CachingProviderType.SQLite;
            this.ProviderStats         = this._cacheStats;
            this.ProviderMaxRdSecond   = _options.MaxRdSecond;
            this.IsDistributedProvider = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:EasyCaching.SQLite.SQLiteCachingProvider"/> class.
        /// </summary>
        /// <param name="dbProvider">dbProvider.</param>
        public DefaultSQLiteCachingProvider(
            ISQLiteDatabaseProvider dbProvider,
            IOptionsMonitor <SQLiteOptions> options,
            ILoggerFactory loggerFactory = null)
        {
            this._dbProvider = dbProvider;
            this._options    = options.CurrentValue;
            this._logger     = loggerFactory?.CreateLogger <DefaultSQLiteCachingProvider>();
            this._cache      = _dbProvider.GetConnection();
            this._cacheStats = new CacheStats();
            this._name       = EasyCachingConstValue.DefaultSQLiteName;

            this.ProviderName          = this._name;
            this.ProviderStats         = this._cacheStats;
            this.ProviderType          = _options.CachingProviderType;
            this.ProviderOrder         = _options.Order;
            this.ProviderMaxRdSecond   = _options.MaxRdSecond;
            this.IsDistributedProvider = false;
        }
Exemplo n.º 3
0
        public DefaultSQLiteCachingProvider(
            string name,
            IEnumerable <ISQLiteDatabaseProvider> dbProviders,
            SQLiteOptions options,
            ILoggerFactory loggerFactory = null)
        {
            this._dbProvider = dbProviders.Single(x => x.DBProviderName.Equals(name));
            this._options    = options;

            if (options.EnableLogging)
            {
                this.Logger = loggerFactory.CreateLogger <DefaultSQLiteCachingProvider>();
            }

            this._cacheStats = new CacheStats();
            this._name       = name;

            this.ProviderName        = this._name;
            this.ProviderType        = CachingProviderType.SQLite;
            this.ProviderStats       = this._cacheStats;
            this.ProviderMaxRdSecond = _options.MaxRdSecond;

            _info = new ProviderInfo
            {
                CacheStats     = _cacheStats,
                EnableLogging  = options.EnableLogging,
                LockMs         = options.LockMs,
                MaxRdSecond    = options.MaxRdSecond,
                ProviderName   = ProviderName,
                ProviderType   = ProviderType,
                SerializerName = options.SerializerName,
                SleepMs        = options.SleepMs,
                CacheNulls     = options.CacheNulls
            };

            InitDb(_dbProvider);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:EasyCaching.SQLite.SQLiteCachingProvider"/> class.
 /// </summary>
 /// <param name="dbProvider">dbProvider.</param>
 public DefaultSQLiteCachingProvider(ISQLiteDatabaseProvider dbProvider)
 {
     this._dbProvider = dbProvider;
     this._cache      = _dbProvider.GetConnection();
 }