Answer: The connection to Redis is handled by the ConnectionMultiplexer class which is the central object in the StackExchange.Redis namespace. The ConnectionMultiplexer is designed to be shared and reused between callers.
e.g.
static IDatabase GetRedisInstance()
{
return
ConnectionMultiplexer
.Connect("localhost")
.GetDatabase();
}
The GetDatabase() of the ConnectionMultiplexer sealed class obtains an interactive connection to a database inside redis.
Asked In: Many Interviews |
Alert Moderator