The Dopefly Tech Blog

<< The Dopefly Tech Blog Main page

How Dopefly almost stayed alive

posted under category: ColdFusion on August 2, 2005 at 1:00 am by MrNate

So Dopefly's web host decided to upgrade their servers without telling anyone. Wasn't that special? Glad to have my site back up, and apparently without losing anything in the process. That's a relief. I know, I know, I get what I paid for, but I'm happy (enough) with my $5/mo cf host. Yes they're terrible, and totally unreliable, but it's kind of an adventure, not being able to rely on databases and servers.

The site was actually up for 3 of the 4 days without a database, and yes, this is a fairly heavily data-driven site. How is it possible you might ask? Through the wonders of scope caching. Somehow when I built this site, I knew this would happen, so I'm glad to see it's paid off.

Now normally, a CF Cached query will time out at a certain time, or worse, never, without clearing all the cached queries on the server. With a good scope caching strategy, you can save recordsets in the application scope until the scope is cleared.

What I did was save my data in my query caching CFC, with regular interval timeouts (like 24 hours). If the query errored, I would increase the timeout by a minute and return the previously cached version.

Another advantage of this strategy is the ability to remove any cached entries when an update is made. When I click the submit button on my blog form, it inserts the record for this entry and invalidates my cached recordsets that will be affected by the change. The result is an instant update to would-be cached data.

Now the reason why Dopefly was down yesterday was because they reset the CF server. There goes my cached application data and my site. So now I'm devising a strategy to persist my cached data to disk (evil grin).

I know, I know, "Geez Nate, get a better host." But it's kind of exciting, living on the edge.

Too old to comment!
On Aug 2, 2005 at 1:00 AM Scott ( said:
Geez Nate, get a better host.

No seriously. You'll be pissed if you lose something important.
Too old to comment!