Caching, why it have to be so complicated ?

Well I have a subject where I have a lot to learn, and it's caching. For the moment I don't really get it. I tried to use some cache functions in some of my projects, but I failed almost all the time.

I can't really find a clever article on all the different options, and it seems that the Cache class in .Net is overcomplicated. I discovered that for example timespan is more important than I could imagine, and it's really hard to tune up precisely the different parameters to have something really working and universal. I mean working well with the different browsers, different platforms, etc...

Last time I used the server cache, it was working well for a week, and suddenly I had to deal with a lot of Internal errors, you know the so infamous error you can't catch.

I removed the cache and now it's working very well. Of course the performances are surely not the same, but I can't afford any crash on a live website.

Unless somebody has a great web link on the subject, I give up on this for the moment.

 

4 Comments

  • First, you generally have to design for caching. Its something you do at the end of the process.



    OK, now I got my Patterns and Practices quote out of the way, could you be more specific? "Infamous error you can't catch"?



    -Scott

  • Thanks Scott. The problems I have with caching is when I try to implement 3 dropdown lists dynamically built from a database, and then I use server.transfer to pass the information to a result page.

    Passing the cached dropdown was ok.

    It seems I had a great difficulty with the timeout setup of the cache. Sure maybe I am confusing Timespan and time expiration, but I found that if I play with these values, I can have very strange result, including the famous error Internal Network error. After removing h cache everything was back to normal. check www.scoilnet.ie for example and go to Teachers menu First level to see what I am talking about for the dropdowns lists.

    If you want I can setup a test site with the cache activated to let you see the problems.

  • Are you caching the DropDownList itself? Or just the data?



    If it is the first, I probably would not cache the control itself and instead would just cache the data.



    If you cache the control, multiple people hitting your site at the same time will be using the same control! (ie, they are all referencing the same control).



    -Scott

  • no Scott I am caching the data

Comments have been disabled for this content.