[thesite] last 5 query

Seth Bienek seth at sethbienek.com
Tue Nov 28 13:18:37 CST 2000

Hi All,

Just got back from Vegas... Catching up on 500+ emails in the ol' inbox, and
this thread caught my eye.

> I don't know enough about Cold Fusion to say if this is robust enough..

I DO know enough about ColdFusion to say that storing this information in an
Application scoped variable makes a whole lot of sense, for a couple of

1. We are talking about mere bytes of information, to be stored in the app
server's RAM.  If the server has any hair on it's ass whatsoever (or even if
it doesn't, I just wanted to use the expression), robustness is not a

2. As we all know, RAM is fast.  Like, really, really fast.  :)

3. The overhead of making any database calls from CF that are not necessary
should be avoided.  If you have information that is relatively static, and
accessed often by multiple users, then by all means make the Application
scope your bitch. Which brings me to my next point; er, caveat...

The drawback:  As far as I know, there is not a way to update an Application
scoped CF variable from a database (unless a trigger can call a .cfm page).
Maybe this can be done as part of the process that actually archives the
mail message?  I don't know too much about how this is currently done..  If
someone wants to enlighten me, I may be able to propose a solution.

To address Joshua's Concern:

> The only reason I would stay away from application scope variables in this
> case is because of extensibility.  Where does one draw the line of what
> should be store in application variables?  The "last-5" might be a
> candidate, but what about usage information, or whatever is
> thought of next.

Application scoped variables should almost always be set in the
Application.cfm.  One reason why is for just the reason you mentioned.  You
should be able to see at a glance exactly what is being saved in the
server's memory.  You could also write a quick little CF app to cycle
through various scopes and tell you the variables and their values in each
scope (I think there may already be a free custom tag in the Developer's
exchange on Allaire's site that does this).

As an example of leveraging the Application scope to enhance the performance
of a site, check out:

This is a content management/collaboration project I wrapped up a few months
back, and since it was so database intensive, our load times were
unacceptably high.

We were taking our biggest hit overall on the site navigation.  By loading
the Pages table (containing page id's, navigation info, and short
descriptions of each page) into a structure in an Application scoped
varible, we reduced connections (and load) on the database server and cut
the page load times in third!  Since the web server and database server were
seperate, and the web server had more than enough RAM (512 MB), loading the
~2500 row table (~5 MB) into memory made all the sense in the world.

Check out the site, it's FAF.  ;)


Seth Bienek
Solutions Development Manager
Stonebridge Technologies, Inc.
972.455.7294 tel
972.404.9754 fax

More information about the thesite mailing list