> I haven't made use of a persistent scope to this point.
> I thought, perhaps, that just using:
>
> <cfquery name ="queryName" datasource="dsn" cachedWithin =
> "#createTimeSpan(0,1,0,0)#">
>
> in the opening tag made the query data persistent without
> utilizing a persistent scope.  As I mentioned to Justin, just
> my ignorance about how caching works.

It does make the query data persistent. However, it doesn't create a
persistent variable that you can directly access. This will simply
pull data from CF's memory rather than the database the next time you
run the same query (with the same SQL and tag attributes) within the
next hour. In this case, you'd simply rerun the function that calls
the query as if you hadn't run it before. The advantage of this sort
of caching is that you don't have to put anything in your code to take
advantage of it (other than the CACHEDWITHIN attribute).

If you want to get a variable that you can reference directly without
rerunning the CFQUERY, you need to store the query in a variable that
will be available from wherever you want to reference it. In this
case, you'd get rid of the CACHEDWITHIN attribute and just store the
query itself in the appropriate scope.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340519
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to