Thursday, October 06, 2011 6:16 PM usoup

Enterprise Library Cache Key is case sensitive

Learnt it the hard way on Enterprise Library 4.1. We were getting inconsistent response from the cache manager for a key that we defined. Apparently, to the cache manager, key named “Key A” is different from “key a”. The following code snippet will give you 2 counts of cached objects.

 

ICacheManager mgr = CacheFactory.GetCacheManager();
mgr.Add("Key A", "Value A");
mgr.Add("key a", "lower cased a");

 

If you check the content of the cache:

mgr.GetData("Key A")
"Value A"


mgr.GetData("key a")
"lower cased a"


mgr.GetData("kEY a")
null


mgr.Count
2

# Cach key | Premierpb

Friday, February 10, 2012 7:49 PM by Cach key | Premierpb

Pingback from  Cach key | Premierpb