Пример #1
0
 /// <summary>
 ///     初始化一个<see cref="RedisCache" />实例。
 /// </summary>
 /// <param name="database"></param>
 /// <param name="region">缓存区域名称</param>
 /// <param name="serializableService">序列化服务。</param>
 public RedisCache(IDatabase database, string region, ISerializableService serializableService)
 {
     _database            = database ?? throw new ArgumentNullException(nameof(database));
     _region              = region;
     _cacheKeyPrefix      = $"Ixq.Redis.RedisCache.{region}.";
     _serializableService = serializableService ?? throw new ArgumentNullException(nameof(serializableService));
 }
Пример #2
0
        public RedisCache(AppConfig appConfig, ISerializableService serializableService,
                          IConnectionMultiplexerAccessor connectionMultiplexerAccessor)
        {
            _appConfig                     = appConfig;
            _serializableService           = serializableService;
            _connectionMultiplexerAccessor = connectionMultiplexerAccessor;

            _database = _connectionMultiplexerAccessor.ConnectionMultiplexer.GetDatabase();
        }
Пример #3
0
        public RedisCacheTests()
        {
            _appConfig = new AppConfig
            {
                RedisCacheKeyPrefix        = "Ixq.Soft::",
                RedisCacheConnectionString = "localhost:6379"
            };

            _serializableService = new BinarySerializableService();
            _cma = new ConnectionMultiplexerAccessor(_appConfig);
        }
Пример #4
0
 /// <summary>
 ///     初始化一个<see cref="RedisCacheProvider" />实例。
 /// </summary>
 /// <param name="options">配置选项。</param>
 /// <param name="serializableService">序列化服务。</param>
 public RedisCacheProvider(ConfigurationOptions options, ISerializableService serializableService)
 {
     _options            = options;
     SerializableService = serializableService;
 }
Пример #5
0
 /// <summary>
 ///     初始化一个<see cref="RedisCacheProvider" />实例。
 /// </summary>
 /// <param name="connectionString">Redis 连接串。</param>
 /// <param name="serializableService">序列化服务。</param>
 public RedisCacheProvider(string connectionString, ISerializableService serializableService)
 {
     _connStr            = connectionString;
     SerializableService = serializableService;
 }