I am trying the Redis StackExchange change provider with Azure and just wondering on the best setup.
Considering the following code
private static ConnectionMultiplexer connection = ConnectionMultiplexer.Connect(...);
public string Get(string key)
{
IDatabase cache = connection.GetDatabase();
return cache.StringGet(key);
}
Is the getting of the database going to be a performance hit calling it each time a call to the cache is made?
Should it be managed some way else?
Should it just be created for the lifetime of the object but not static?
What is best practice around managing the IDatabase?