[thelist] ColdFusion Application Variables

Seth Bienek evolt.list at sethbienek.com
Thu Feb 6 11:00:17 CST 2003


Hi Michael,

Thanks for the response.  And the tip!  There are a few things I didn't
mention:

> -----Original Message-----
> I'd suggest creating the structures in the request scope, and
> making sure that the code that does so is executed on every request.

The values for the most of the application variables come from the
database, in two separate queries; the reason for placing the data into
persistent variables in the first place is to avoid having to hit the
database two more times on every page load.

> The request scope, as you probably know, is available to
> everything: custom tags, UDFs, included files, etc.

This is the other reason for using the request scope.  The application
and its components are all highly customized to work together.  Code
modularity (is that a word?) is not as great a concern as performance in
this case.

> The application scope is also available, but to create
> variables within it, you must exclusively lock it. To read
> variables, you must readonly lock it.

Which is another reason that tossing the whole thing into the request
scope is so appealing.

> So, with all that said, creating all of your variables in the
> request scope is a lot more efficient, and easier to access.

...But not always practical.  Thank you for the great response.  I am
going to stick to copying the app structure into the request scope, but
am going to see about switching to Duplicate() from StructAppend().
After all, if I'm only creating a pointer to the shared-scope variables,
then I am not properly addressing the locking issues, right?

Thanks again!

Seth

...And some random tips, just because.

<tip type="Managing MP3's with Windows XP">
When viewing a folder containing mp3's in Windows xp, you can switch to
"Details" view, then right click the column header to add "Artist",
"Album Title", "Track Number", etc to the list of columns to display
(and sort).  The info comes directly from each file's ID3 tag.  Now you
can more easily manage and categorize your mp3's without having to
install a third party product!
</tip>

<tip type="Coping With Winamp 3">
One of people's biggest frustrations with WinAmp 3 is the changes made
in the playlist window.  Now it's split into two parts; the playlist
itself and a section that allows you to manage and select from multiple
playlists.  You can get rid of the latter by double-clicking the
division border between the two.  This sounds simple, but is not exactly
intuitive to figure out on your own. :)
</tip>




More information about the thelist mailing list