I'am trying to implement Redis cache service by StackExchange.Redis library.
My Redis client:
public class RedisClient
{
private static Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
{
return ConnectionMultiplexer.Connect(string.Format("{0},{1}",
ConfigurationManager.AppSettings.GetStringOrDefault("redis_masters", "someIP1:6379"),
ConfigurationManager.AppSettings.GetStringOrDefault("redis_slaves", "someIP2:6379")));
});
public static ConnectionMultiplexer GetConnection
{
get
{
return lazyConnection.Value;
}
}
}
And i try to get connection in this way:
using (var redis = RedisClient.GetConnection)
{
...
}
I get exception: "It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. UnableToResolvePhysicalConnection on PING"
I also tried to add some configuration to connection like this:
ConnectionMultiplexer.Connect(string.Format("{0},{1},Ssl=false"
And i get another exception: "ValueFactory attempted to access the Value property of this instance."
My connection to Redis worked fine with enother library : "StackExchange.Redis"
I just try to migrate is to "ServiceStack.Redis"
What i missing?