Just stick the query object in a shared scope.  If it's user specific, then
the session scope would be the way to go, otherwise application.

<cfquery ... Name="get">
  SELECT ...
</cfquery>
<cfset application.myQuery = get />

Just keep in mind that the query will not expire until the application scope
expired (two days without a request by default, I believe).  So you may want
to store an additional value (myQueryCreateDate) that stores when it was
created.  Each request check that and see if it's more than X minutes
(seconds, hours, days) ago, and if it is, rerun the query.

Cheers,
barneyb

> -----Original Message-----
> From: Les Irvin [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 19, 2004 2:29 PM
> To: CF-Talk
> Subject: Cached queries
>
> I would like to carry query results across a number of pages
> as users move
> through the site without having to perform the query on each page.  
>
> I understand persistant queries with the "cachewithin"
> attribute but that's
> not possible with this query as it includes an embedded
> <CFQUERYPARAM> tag.
>
> What's the best, least CPU-intensive solution to this problem?
>
> Thanks in advance for the help,
> Les
>
>
>
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to