config/settings.cfm
file:application
scope, so take this into consideration when deciding the number of items to store.maximumItemsToCache
has been reached.n
"), but you can set it to seconds ("s
") for example if you want more precise control over when a cached item should expire. For the rest of this chapter, we'll assume you've left it at the default setting.caches()
, findAll()
, includePartial()
, etc).true
, CFWheels caches identical queries during a request. See the section titled Automatic Caching of Identical Queries below for more information about this setting.true
, CFWheels will clear out all cached queries when doing a reload=true
request. This is usually a good idea, but if you want to avoid hitting the database too hard on application reloads, you can set this to false
to keep queries cached and ease the load on the database.false
, all plugins will reload on each request (as opposed to during reload=true
requests only). Setting this is only recommended if you are developing a plugin yourself and need to see the impact of your changes as you develop it on a per-request basis.reload=true
request or restart the ColdFusion server, for example. The downside is that it makes for slightly slower development because the pages will not load as fast in this environment.cacheDatabaseSchema
is set to false
, you can add a field to the database, and CFWheels will pick that up right away. When cacheModelConfig
is false, any changes you make to the config()
function in the model file will be picked up. And so on.browseByUser
and browseByTitle
actions for 30 minutes:caches()
function call goes inside the config()
function at the top of your controller file and accepts a list of action names and the number of minutes the actions should be cached for.browseByUser
page?controller, action, key
, and params
variables. This means, for example, that paginated pages are all stored individually in the cache (because the URL variable for the page to display would be different on each request).showArticle
page is cached and a user is adding a new comment to it.)static
argument on caches() to true
. This will cache your content using the cfcache
tag behind the scenes. This means that the CFWheels framework won't even get involved with the subsequent requests until they expire from the cache again (please note that application events like onSessionStart
, onRequestStart
, etc. will run though).browseByUser
action for 1 hour:cache
argument in a call to includePartial() or renderPartial(). You can pass in cache=true
or cache=x
where x
is the number of minutes you want to cache the partial for.true
, the default cache expiration time will be used.userId
variable for example, they will be cached separately.updatedAt
property on a user object and pass that in to includePartial
. As soon as it changes, CFWheels will recreate the cached content (since the cache key is now different).cachedwithin
attribute in the <cfquery>
tag. The query caching in CFWheels is very similar to this.belongsTo
association from article
to author
, then you will likely write a lot of article.author().name()
calls. In this case, CFWheels is smart enough to only call the database once per request if the queries are identical. So don't worry about adding performance hits when making multiple calls like that in your code.