tvv

tvv

  • NA
  • 4
  • 4.8k

Cache Update in .Net Memory cache ?

Jun 19 2015 12:59 AM

 Hi,

How to update cache . My cache object contains 3 fields.
Sub,Mark,Result
Here Sub is key, I want to update Result using Sub and Mark.

(E.g)At first cache has,
Sub = Maths,
Mark = 40,
Result = Fail

Now i will update Result as 'Pass'. There are list of records in cache. I want to update result for this sub and mark only.

How can i achieve this?

Please resolve my problem.

Here is my code..

 
values in cache = Sub - Maths , Mark - 40, Result - Fail

Now Update logic is to change result as pass,

 PolicyCacheManager policyCache = new PolicyCacheManager();
List<PolicyBO> resultList = new List<PolicyBO>();
var getResult = new PolicyBO
{
Subject= sub, --- Maths
Mark= mark, --- 40
Result= res --- Pass (update)
};
resultList.Add(getResult);
policyCache.Set(resultList,sub);

-------------
cache code part:

public static void Set(List objectToCache, string key) where T : class
{
// Cache.Remove(key);
Cache.Set(key, objectToCache, DateTime.Now.AddDays(30));
}

what's the code change need to be done? 
 


   Thanks