I have this service:
public bool Inquiry( string Plaque)
{
}
As you can see the output of my service is true
or false
for a specific plaque. I want to cache the output that is true
for 15 days. I mean, when the result was true for specific plaque, I need to cache this data,so if again the system call my service for that plaque, it should be returned by cache system. Is it possible?
Best regards.
if (_inquiryview.ValidTest == "1")
{
HttpContext context = HttpContext.Current;
HttpCachePolicy cachePolicy = HttpContext.Current.Response.Cache;
cachePolicy.SetCacheability(HttpCacheability.ServerAndPrivate);
cachePolicy.SetExpires(DateTime.Now.AddDays(15));
cachePolicy.VaryByHeaders["Accept"] = true;
cachePolicy.VaryByHeaders["Accept-Charset"] = true;
cachePolicy.VaryByHeaders["Accept-Encoding"] = true;
cachePolicy.VaryByParams["*"] = true;
cachePolicy.SetValidUntilExpires(true);
}