> Is it advisable to use locking when referencing a cached 
> query?  I would assume a cached query fits the bill of being 
> shared data. If so, then wouldn't the lock need to be around 
> the <cfquery> statment as well as references to any query 
> values?

If you're referring to queries cached with the CACHEDWITHIN or CACHEDAFTER
attributes, there's no need for locking those queries. The data that CF
stores after running a query with a caching attribute is not changeable, so
you don't have to worry about concurrent access to the data.

> Does modifying the contents of a cached query 'dirty' the 
> cache, so that the query would automatically be run again on 
> the next reference, or will the query remain (in its modified 
> state) until the cache period expires?

You can't really modify the contents of a cached query (again, assuming that
you're talking about using the caching attributes above). CF doesn't store
those contents anywhere that you can programmatically access. To further
illuminate this, let's say you run the following query:

<cfquery name="foo" datasource="bar"
cachedwithin="#CreateTimeSpan(0,1,0,0)#">
        SELECT fooval1, fooval2 from footable
</cfquery>

Then, perhaps you use one of the CF 3.x query functions:

<cfscript>
QueryAddRow(foo);
QuerySetCell(foo, "fooval1", "new value 1");
QuerySetCell(foo, "fooval2", "new value 2");
</cfscript>

Finally, when you reference the query, it would have your new row in it.
However, what you've really modified is the query variable foo, not the
underlying cached recordset, which CF stores after executing the query. CF
doesn't let you touch this recordset directly, and will only reuse it if
someone executes the same CFQUERY tag within the specified time span.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
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.

Reply via email to