예제 #1
0
        /// <summary>
        /// 初始化一个<see cref="DefaultRedisCacheProvider"/>类型的实例
        /// </summary>
        /// <param name="dbProvider">Redis 数据库提供程序</param>
        /// <param name="serializer">缓存序列化器</param>
        public DefaultRedisCacheProvider(IRedisDatabaseProvider dbProvider, ICacheSerializer serializer)
        {
            dbProvider.CheckNotNull(nameof(dbProvider));
            serializer.CheckNotNull(nameof(serializer));

            _dbProvider = dbProvider;
            _serializer = serializer;
            _database   = _dbProvider.GetDatabase();
            Client      = new RedisClient(_dbProvider);
        }
예제 #2
0
 /// <summary>
 /// 初始化一个<see cref="RedisClient"/>类型的实例
 /// </summary>
 /// <param name="dbProvider">Redis 数据库提供程序</param>
 public RedisClient(IRedisDatabaseProvider dbProvider)
 {
     dbProvider.CheckNotNull(nameof(dbProvider));
     _dbProvider = dbProvider;
     _database   = _dbProvider.GetDatabase();
 }