Skip to content

Miscellaneous

caches()

caches() — returns any

Tells CFWheels to cache one or more actions.

NameTypeRequiredDefaultDescription
actionstringyesAction(s) to cache. This argument is also aliased as actions.
timenumericyes60Minutes to cache the action(s) for.
staticbooleanyesfalseSet to true to tell CFWheels that this is a static page and that it can skip running the controller filters (before and after filters set on actions). Please note that the onSessionStart and onRequestStart events still execute though.
appendToKeystringyesList of variables to be evaluated at runtime and included in the cache key so that content can be cached separately.
// Cache the `termsOfUse` action
caches("termsOfUse");

// Cache the `termsOfUse` action for 30 minutes
caches(actions="browseByUser,browseByTitle", time=30);

// Cache the `termsOfUse` and `codeOfConduct` actions, including their filters
caches(actions="termsOfUse,codeOfConduct", static=true);

// Cache content separately based on region
caches(action="home", key="request.region");