> Depending on what the query is doing you can use the query as
> and app query and only one user will hit it within the time
> period. If the query is user specific it won't help any.
>
> Hope this helps. It will allow one db hit for all users in
> 10 minutes. Passing refresh=1 in the URL will reload the app
> before the 10 min is up.
>
> <cfscript>
> if (isdefined('url.refresh'))
> // param that allows manual refresh of queries
> timespan = createtimespan(0,0,0,0);
> // clear cache
> else
> timespan = createtimespan(0,0,10,0);
> // ten minute cache
> </cfscript>
>
> <cfquery name="application.getEvents"
> datasource="#application.dsn#" maxrows="4" cachedwithin="#timespan#">
> SELECT *
> FROM Calendar
> WHERE Expire_date > #application.eventdate#
> ORDER BY Date_Start,event_title
> </cfquery>
You shouldn't use the CACHEDWITHIN attribute if you're putting the query in
the Application scope, or vice versa. You're caching the query twice, once
as an application variable and once using CF 4.x query caching. The two work
completely differently.
When you use CACHEDWITHIN/CACHEDAFTER, you're instructing CF to store the
query in the query cache, which by default can contain 100 queries. CF will
reuse the query in this cache if it processes another CFQUERY with identical
attributes, except for CACHEDWITHIN/CACHEDAFTER, and an identical SQL
statement. This makes it ideal for caching data from dynamically generated
SQL statements.
When you prefix the query name with "application.", "session.", or "server",
you're storing the query object in one of those scopes. This simply creates
a variable in that scope which contains the recordset. If you want to flush
that recordset from the memory scope, you'll have to overwrite the variable
or delete it from the scope's structure using StructDelete.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
------------------------------------------------------------------------------
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.