I'm creating a POC to see if we can use the azure redis cache for our next project. I had a look at this MSDN documentation http://azure.microsoft.com/en-us/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/#connect-to-cache.
And have following questions/doubts:
- Only way (elegant) to connect to redis is via code below? Is it not possible to do same as Redis Cache where you configure and just works?
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("contoso5.redis.cache.windows.net,ssl=true,password=...");
We need to call above and connect to redis for every Get and Set? If not how can we call only once and re-use?
All I can see is StringGet and StringSet. Is it possible to set the complex .NET Types as well? Example would be good. Below is what I've done in past using dedicate azure cache or ent.Lib cache.
public class CacheManager {
public void AddToCache(string Id, T value) { string Key = this.MakeKey(Id); if (this.m_Cache.Contains(Key)) { this.m_Cache.Remove(Key); } ------ this.m_Cache.Add(Key, value,CacheItemPriority.Normal, null, expireTime); } }