Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
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,
Sub = Maths,
Mark = 40,
Result = Fail

Now i will update Result as 'Pass'.

How can i achieve this?

Please resolve my problem.

Thanks
Posted

1 solution

 
Share this answer
 
Comments
vksvpp 19-Jun-15 0:25am    
values in cache = Sub - Maths , Mark - 40, Result - Fail

Now Update logic is to change result as pass,

Here is my code,

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?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900