0

Team,

Beginner in Azure. I am running a Azure web app referencing a azure redis cache. Now i have a requirement whereby i have to load the colleagues data into the primary cache upon the first load and any updates to the colleagues count is loaded in the secondary cache. Once completed a swap is done where by the change in the value of the primary key value.

So i have implemented in such a way that it will first identify which is primary and which is secondary. ( Please note that i am not sure if this approach is correct or not). I have introduced a primary key value for that matter. So i use the code below

try 
{ 
    IServer server = cacheFactory.GetServer(getEndPoint(), null); //TODO read from config 
    var StoreCache = cacheFactory.GetDatabase(0, null); 
    StoreCache.StringSet("PrimaryCacheKey",cache.Name); //Set the primary cache key to be whatever this cache is 
} 
catch (Exception ex) 
{ 
    this.Logger.Error(ex, "Error setting primary cache."); 
    throw; 
} 

But this throws an error saying "Object not set to reference of the object). When i debug the value of the cache.Name= 1. Why does it not find the cache.Name when i am trying to set the key for this.

Any other suggestions welcome please.

Marc
  • 3,905
  • 4
  • 21
  • 37
user3276487
  • 109
  • 10

1 Answers1

1

Actually, it sounds like exactly the issue which is already tracked in the StackExchange.Redis repository. So, I suggest that you could update your nuget version and restart it.

For more details, you could refer to this similar issue.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30
  • Thanks...I used the latest version of stack excahnge redis and secondly noticed that the redis cache was beneath a Virtual network. I create a new redis cache from scartch without a virtual network and all was ok! – user3276487 Feb 16 '19 at 13:36