> How do I define a cached query and then access it?
> 
> Problem is that I have a menu built off a query, the pages 
> built from those menu choices off other queries. Click too 
> many menu items too quickly and poof! The CF service reboots.  
> What would be the best way to handle this?

In CF 4.x, you can use the CACHEDWITHIN or CACHEDAFTER attributes to cache a
query; when that identical query is run later, the recordset will be
retrieved from the cache instead of from the database. If many people see
the same menu items, query caching is probably a good idea. If the menu
items don't change much, you might consider caching the generated HTML
output for the menu using CFCACHE, which will mean even less server-side
work at runtime.

> Can I set a query to a variable?

Yes, you can store a query in any of the persistent memory scopes: Server,
Application, Session. Using the query caching attributes is a little easier,
though, in most cases.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to