I have been scratching my head for this from last one week, i will really appreciate any help here, so here we go:

I have a website running on Dnn 7.4 and i want to add caching functionality on it. On first attempt it reads from database and on second attempt onwards it should read from cache, the problem is on first attempt it reads as expected, on 2nd attempt it reads from cache also, but then again on 3rd attempt it fetches from database. Here's my simple code:

if (Cache["Something"] != null)
        {
            Response.Write("Cache" + Cache["Something"]);
        }
        else
        {
            Cache["Something"] = "Cool";
            Response.Write("Latest" + Cache["Something"]);
        }

Related posts

Recent Viewed