コード例 #1
0
ファイル: SessionService.cs プロジェクト: popalex/SaltyEmu
        public SessionService(RedisConfiguration config)
        {
            var options = new RedisCacheClientOptions
            {
                ConnectionMultiplexer = ConnectionMultiplexer.Connect(config.Host)
            };

            _cache = new RedisCacheClient(options);
        }
コード例 #2
0
ファイル: ServerApiService.cs プロジェクト: popalex/SaltyEmu
        public ServerApiService(RedisConfiguration config)
        {
            var options = new RedisCacheClientOptions
            {
                ConnectionMultiplexer = ConnectionMultiplexer.Connect(config.Host),
                Serializer            = new JsonNetSerializer(new JsonSerializerSettings
                {
                })
            };

            _cache = new ScopedHybridCacheClient(new RedisHybridCacheClient(options), Prefix);
        }
コード例 #3
0
        private GenericRedisCacheClient(string basePrefix, RedisConfiguration conf)
        {
            DataPrefix = "data:" + basePrefix + ':';
            KeySetKey  = "keys:" + basePrefix;
            var tmp = new RedisCacheClientOptions
            {
                ConnectionMultiplexer = ConnectionMultiplexer.Connect(new ConfigurationOptions
                {
                    Password  = conf.Password,
                    EndPoints = { $"{conf.Host}:{conf.Port}" },
                }),
                Serializer = new JsonNetSerializer(new JsonSerializerSettings
                {
                })
            };

            CacheClient = new RedisHybridCacheClient(tmp);
            Log.Info($"Connected to redis : {conf.Host}");
        }