I'd recommend using CachedAfter instead of CachedWithin...

<cflock scope="application" type="exclusive" timeout="30">
        <cfparam name="application.contentcachedafter" default="#now()#">
        <cfset request.contentcachedafter = application.contentcachedafter>
</cflock>

<cfquery name="rscontent" cachedafter="#application.contentcachedafter#">
        SELECT ...
</cfquery>

When you update the content, simply update the cachedafter variable

<cfquery > UPDATE ...</cfquery>
<cflock scope="application" type="exclusive" timeout="30">
        <cfset application.contentcachedafter = now()>
</cflock>

Assuming the application never times out, the query will remain cached
indefinitely, so a day, 7 days, 30 days, etc.


s. isaac dealey                954-776-0046

new epoch                      http://www.turnkey.to

lead architect, tapestry cms   http://products.turnkey.to

tapestry api is opensource     http://www.turnkey.to/tapi

certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816

> Hello list - I have a question about caching results from
> a SQL query.
> Short question : I want to set a query cache for like 7
> days.
> very bad? or not a big deal?

> Longer Question / Explanation:

> I used a quick access database to setup content for a
> site. I output 1
> main grouped queries - which is dynamically set by page
> names on 12
> different pages - The code just switches a simple key in
> the WHERE
> statement.

> I planned on using CFCOntent to create static pages BUT to
> ease
> development and content - I built in a set of admin
> functions to add and
> remove information and quickly reorganize it. Client loved
> it so much
> they want to have the ability to use that all the time.
> Problem is I
> don't want to maintain different pages.
> I considered adding a long cache (like 7 days) to limit
> the amount of
> times the query is run.......And on the admin page -
> having a button
> that can immediately refresh that cache.

> Adivisable or not? Is it best for me simply to do it the
> right way and
>  have admin section changes publish everytime through
>  cfcontent?- I am
> just nervouse because the pages are complex and use alot
> of flash,
> javascript and css code.

> I hope I am clear - Any advice is much needed and greatful
> Jay


> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~|
> 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.

>                               Unsubscribe: http://www.houseoffusion.com/cf_lists/uns
>                               ubscribe.cfm?user=633.558.4


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to