static Common()
{
_rawContext = new Context(Config, new RawSerializer());
_jsonContext = new Context(Config, new JsonSerializer());
_msgPackContext = new Context(Config, new MsgPack.MsgPackSerializer());
#if (NET45 || NET461)
_binaryContext = new Context(Config, new BinarySerializer());
All = new[] { _binaryContext, _rawContext, _jsonContext, _msgPackContext };
BinAndRawAndJson = new[] { _binaryContext, _rawContext, _jsonContext };
#else
BinAndRawAndJson = new[] { _rawContext, _jsonContext };
All = new[] { _rawContext, _jsonContext, _msgPackContext };
#endif
Thread.Sleep(1500);
_rawContext.Cache.FlushAll();
// Get the redis version
var server = _rawContext.GetConnectionMultiplexer().GetServer(_rawContext.GetConnectionMultiplexer().GetEndPoints()[0]);
VersionInfo = server.Info("Server")[0].First(x => x.Key == "redis_version").Value.Split('.').Take(2).Select(x => int.Parse(x)).ToArray();
// Enable keyspace notifications
var eventsConfig = server.ConfigGet("notify-keyspace-events");
if (!eventsConfig[0].Value.ToUpper().Contains('K') || !eventsConfig[0].Value.ToUpper().Contains('E'))
{
server.ConfigSet("notify-keyspace-events", "KEA");
}
}
}