> But if this is pre-cfmx then you have to readonly cflock
> the query , since
> it contains an app var, right? :(

Actually that should have read cachedafter="#request.contentcachedafter#" in
the query -- I usually copy all my pertinent application variables to the
request scope at the beginning of a page request which I think is good
practice MX or otherwise since it also helps to isolate against race
conditions. It's roughly equivalent of what SQL Server does internally
during a query or stored procedure -- it takes a snap-shot of the time and
the table(s) being queried for the duration of that query (which is
especially important to remember if you ever use a cursor).

In failing the use of an application variable, there's always something like
this:

<cffile action="write"
        file="#expandpath('includes/contentcachedafter.cfm')#"
        output="<cfset request.contentcachedafter = ""#now()#"">">

And then include that in the application.cfm file. I prefer using the
application var (and I'm sure at least one person on the list will pipe up
with "includes suck on mx").

> For the sake of argument, does the length of the caching
> mean so much?  I mean, if you set it to 10 minutes wouldn't
> even that pretty much take a mountain of weight off the db?
> 1 hour would seem, on the surface and with admittedly little
> detailed info, to be more than plenty to assure a
> well-rested db.

Well if I'm understanding this particular problem correctly the larger
problem is less a matter of load on the db (although that's always an issue)
than it is the fact that individual pages have to do a lot of logical
acrobatics to display a given page and because of that page load times are
slow, so squeesing a few seconds out of the page load time by cacheing
queries helps to make the pages load faster, in which case, you might not
want the page to be noticeably slower once per hour. Granted, that's just
how I read the post -- I could be way off base.

Beyond that I always try to get as much as I can out of cacheing methods /
routines, not necessarily out of current need, but because the better your
cacheing is now, the easier it is to scale the application up for more users
and more data later on.

Though ultimately in many if not most cases you're right, even 1 hour would
probably suffice.


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


> --Matt Robertson--
> MSB Designs, Inc.
> http://mysecretbase.com

> ----- Original Message -----
> From: "S. Isaac Dealey" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Thursday, February 06, 2003 4:47 PM
> Subject: Re: Really Long Cache Period- advisable?


>> 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
> Your ad could be here. Monies from ads go to support these
> lists and provide more resources for the community.
> http://www.fusionauthority.com/ads.cfm

>                               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
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/unsubscribe.cfm?user=89.70.4
                                

Reply via email to