c# - StackExchange.Redis Lazy connection configuration -
i'am trying implement redis cache service 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 { { return lazyconnection.value; } } }
and try connection in way:
using (var redis = redisclient.getconnection) { ... }
i exception: "it not possible connect redis server(s); create disconnected multiplexer, disable abortonconnectfail. unabletoresolvephysicalconnection on ping"
i tried add configuration connection this:
connectionmultiplexer.connect(string.format("{0},{1},ssl=false"
and exception: "valuefactory attempted access value property of instance."
my connection redis worked fine enother library : "stackexchange.redis"
try migrate "servicestack.redis"
missing?
use password in configuration
connectionmultiplexer.connect("localhost,password=xxxxx");
Comments
Post a Comment