Absolutely not (on the optimizing one user question.) CachedWithin and
CachedAfter are used for queries that require an expiration date. If you've
got data that will need to be updated on a schedule, I'm all for it.
However- if your data is something like, oh say a list of US States used for
dropdowns throughout the system, why add the overhead of a datecompare to
the server (which I assume would be done on each request for the query.)

Another thing to keep in mind is that if the data is SESSION SPECIFIC, i.e.
a user's permissions or something along those lines, how would you use
CachedWithin? There's no way to tell in advance when the session will end!
By using Session scoped queries, you let ColdFusion do it's cleanup work for
that data just as it does for all other session specific data.

I think the latter point is more relevant than the first, but that just's my
opinion. ;-)

Jason

-----Original Message-----
From: Dick Applebaum [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 14, 2000 7:43 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Query Caching


A little different twist on this thread.

Several people have suggested caching queries using session variables:

   <cfquery name="Session.myQuery">

I can see cases where this would be useful, but I wonder if it is a 
good practice.

Wouldn't be better to use the more general "CachedWithin or 
CachedAfter" parameters on the Query statement?

It is my understanding that CF performs some magic with this format, 
and can efficiently cache queries for multiple users... actually, the 
entire system.

By doing session caching, don't we run the risk of optimizing one 
user at the expense of the rest of the system?

TIA

Dick


At 6:39 AM -0400 4/14/2000, [EMAIL PROTECTED] wrote:
>Emily-
>
>It's quite possible to declare a query directly into any of the scope's
>available to your application except Client (unless of course you serialize
>the query w/ wddx.) This is a valid call:
>
><cfquery name="Session.myQuery">
>
>Resulting in Session.myQuery being cached for the duration of the session.
>
>-----Original Message-----
>From: Emily B. Kim [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, April 13, 2000 12:05 PM
>To: [EMAIL PROTECTED]
>Subject: Re: Query Caching
>
>
>>Is it possible to cache a query only for a particular user for only the
>>length of his or her session?
>>I have a query that generates a roles & privileges packet that applies
only
>>to the current session and user. When the session expires so does the
>cached
>>query.
>>What the memory load differences vs. storing a session variable with a
WDDX
>>packet in it?
>
>you would have to write the query to an array and then store it in a
>session variable. but you could also write the query results to a wddx
>packet and write that to a session variable. i don't know that there would
>be more overhead one way or another...? -emily
>---------------------------------------------------------------------------
-
>--
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>---------------------------------------------------------------------------
---
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_tal 
>k or send a message to [EMAIL PROTECTED] with 
>'unsubscribe' in the body.

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to