I think you can reset a query that is using cachedwithin (or cachedafter) by
just running the exact same query without the parameter. This should resets
it.
For example on most of your processing pages you may have something like
this silly example.
<cfquery name=Days datasrouce=dsn cachedwithin(createTimeSpan(7,0,0,0))>
SELECT DAYS
FROM WEEKS
WHERE LANGUAGE = ENGLISH
</cfquery>
If you wanted to refresh this, for whatever reason in your update process
after inserting, updating or deleting information in the table run the query
without the cached param.
<cfquery name=Days datasrouce=dsn>
SELECT DAYS
FROM WEEKS
WHERE LANGUAGE = ENGLISH
</cfquery>
--------------
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA
-----Original Message-----
From: Raymond Camden [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 30, 2003 10:13 AM
To: CF-Talk
Subject: RE: Caching until updated
I have -never- used cachedafter simply because I have not had a need for
it. I either use cachedWIthin to get 'cache for N time' or I cache in
the application (or some other) scope.
========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
Email : [EMAIL PROTECTED]
Blog : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus
"My ally is the Force, and a powerful ally it is." - Yoda
> -----Original Message-----
> From: Cedric Villat [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 30, 2003 10:56 AM
> To: CF-Talk
> Subject: Caching until updated
>
>
> Raymond,
>
> On a side note, would it be better to use cfquery's
> cachedwithin or cachedafter instead of having to take care of
> the cache myself? If so, how would I do that?
>
> Cedric
>
> >I'd watch out using local variable name w/ the same name as the
> >method. You should probably use another name and var scope
> it. Also, in
> >general, I wouldn't directly access the application scope
> from within
> >the CFC. What if you want to use the server scope instead? It would
> >make more sense to just use:
> >
> ><cfset application.myEntries = theCFC.getEntries(...)>
> >
> >Or at least use another CFC to abstract where the caching is done.
> >
> >=============================================================
> ==========
> >=
> >===
> >Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
> >(www.mindseye.com)
> >Member of Team Macromedia
> (http://www.macromedia.com/go/teammacromedia)
> >
> >Email : [EMAIL PROTECTED]
> >Blog : www.camdenfamily.com/morpheus/blog
> >Yahoo IM : morpheus
> >
> >"My ally is the Force, and a powerful ally it is." - Yoda
> >
> >> -----Original Message-----
> >> From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]
> >> Sent: Wednesday, July 30, 2003 10:41 AM
> >> To: CF-Talk
> >> Subject: RE: Caching until updated
> >>
> >>
> >> <cffunction name="getEntries" returntype="query">
> >> <cfargument name="updateCache" required="true" default="1">
> >>
> >> <cfif not IsDefined('Application.myEntries') or
> >> Arguments.updateCache>
> >> <cfquery name="getEntries">
> >> SELECT *
> >> FROM EntriesTable
> >> </cfquery>
> >> <cfset Application.myEntries=getEntries>
> >> </cfif>
> >>
> >> <cfreturn Application.myEntries>
> >> </cffunction>
> >>
> >> On your update entry page just do
> >>
> >> mycfc.getEntries(1|0)
> >>
> >> -----Original Message-----
> >> From: Cedric Villat [mailto:[EMAIL PROTECTED]
> >> Sent: Wednesday, July 30, 2003 12:46 PM
> >> To: CF-Talk
> >> Subject: Caching until updated
> >>
> >>
> >> I'm sure there is a way to do this, I just can't seem to
> >> think through it. Basically, I have a table which isn't going
> >> to change much. Instead of pulling this information from the
> >> database, I'd like to cache the query in the Application
> >> scope. But when a record IS added to that table, I would like
> >> to reset the cached version to include the change.
> >>
> >> Basically, how can I cache something until I know the records
> >> it contains changes? If it helps, I'm using CFC's and can
> >> easily do this in the INSERT function, just can't figure it
> >> out. Any help?
> >>
> >> Cedric
> >>
> >>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
http://www.cfhosting.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4