0

How to test the In Memory caching logic in production or QA environment.

//If the data exists in cache, pull it from there, otherwise make a call to database to get the data
ObjectCache cache = MemoryCache.Default;

var peopleData = cache.Get("PeopleData") as List<People>;
if (peopleData != null)
   return peopleData ;

peopleData = GetAllPeople();
CacheItemPolicy policy = new CacheItemPolicy {AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(30)};
cache.Add("PeopleData", peopleData, policy);
return peopleData;

How to test the functionalities after deployment in Different Environmens.

Mohamed Sahir
  • 2,482
  • 8
  • 40
  • 71
  • Not sure if you mean automated or manual testing? Perhaps trace on the database to see if it gets queried or not? – Ben Hall Jan 26 '18 at 13:32
  • @Ben Hall if automated how will automate is there any tool or methodology , my question is for Manual testing ,In my case Instead of log into database , don't have permission for database and don't want to log into database, so i decided to log into excel .is there any other approach in real time caching . – Mohamed Sahir Jan 26 '18 at 17:29

1 Answers1

0

@MohamedSahir there are 2 ways-

  1. In QA environment , you must be having some logging mechanism like Kibana or plain log files generation over your host server. Then with the help of appropriate log message, you can see whether it is either a cache hit or miss.

  2. Use performance counter as mentioned here

Caffeine Coder
  • 948
  • 14
  • 17