Caching the query or storing the resulting query
object/structure in a persistent scope ( <cfquery
name="application.myQuery"...>) should give the results that you
seem to be looking for. Which users will need access to a
particular object, in this case a query object, should dictate
which persistent scope you should use session/application/server.
Session is the most popular, but not always to the best. If, for
instance, many users would be using the data retrieved by the same
query, then it would be best executed once and its results stored
in the application scope for all to use rather than executed and
stored multiple times so that each user has a copy in their session
scope.
Also, be aware of if and when the data should be refreshed by
rerunning the query on the database and overwriting the previously
stored results with the fresh ones. And finally, on a site with
many concurrent users, you should always be mindful of your memory
constraints - especially when storing large datasets in persistent
scopes for each user. Data can be removed from persistent scopes
using structDelete().