Funky caching

Jump to menu

16 June 2003

I’ve implemented a sort-of funky caching system. The way I originally did things was, if the URL’s not found, then the request gets Server.Transfer -ed to a 404 page. This page figures out if the URL looks right, and if it does, then it Server.Transfers to another script. This connects to the database and find out if the entry/month/day actually exists, and if so, outputs it. If not, then there’s another Server.Transfer to the real 404 page.

I don’t know exactly how slow this was, but I do know that the IIS/ASP combination seems to be…not the fastest, and that there’s no point in hitting the database that much. Also search crawlers seemed to receive 404s while things like the W3C validator didn’t.

So now I have sort-of funky caching. ‘Sort-of’ because the pages are still dynamically generated, both with #INCLUDEs and with a bit of ASP at the top of each page to send the right Content-Type header. After the first time, the database doesn’t get hit again until I add a new entry — at which point it rebuilds the previous entry to let it do the next/previous thing accurately.

Even more ‘sort-of’ cached are the year, month, and day pages. They aren’t really cached at all, because they still look at the database each time, but now they do actually exist, for certain definitions of ‘actually’ and ‘exist.’

Also, don’t you find it amusing that funky RSS is a bad thing, while funky caching’s a good thing?