[thelist] CF: Clearing a cached query?

Morgan Kelsey morgan at morgankelsey.com
Tue Oct 15 10:42:17 CDT 2002

> Your tests are incorrect - and I should have been more clear.
> If you run 2 queries with different white space, where the first query
> has a time out of X minutes and the second query has a timeout of 0
> minutes, you WILL see that the second query is not cached, ie, the debug
> out does NOT show it being cached, however if you rerun the first query
> AND it's within X minutes, it will still show the cached data. To prove
> this, you need to update your tests. Run the first query, run the
> modified second query with a 0 length timeout, then return the first and
> verify that it is marked cached.

ah, i see what you are saying.
i must say that seems silly, though.
if whitespace is insignificant in SQL, why does CF care?

> FYI, in your SQL Server test, your second query had a different name. CF
> 'marks' cached queries with their SQL _and_ their name, username,
> password, basically all the attributes.

my bad, that happened in POST. they had the same names for the test.

> > no offense, but ewww.
> >
> > unless I'm reusing the query (which is another avoidable
> > problem), putting a
> > query in an include seems to add to disorganization, when there are
> > perfectly viable solutions (like the one I presented).
> >
> This I strongly disagree with. What happens if you change your table
> structure? Every file that uses the query then has to be updated. By
> abstracting your queries, you make it much easier to update your code.
> How is disorganized to move multiple queries in multiple files to one
> query in one file?

I agree -- IF i'm reusing the query for a web service or flash app.

Anyway, the whitespace/caching issue isn't really an issue here as we're
talking about replacing the cachedwithin attribute, not changing the


More information about the thelist mailing list