-
Notifications
You must be signed in to change notification settings - Fork 11
StaticCache Plugin
Jason Coward edited this page Aug 4, 2014
·
5 revisions
The StaticCache Plugin should be registered on the following MODX Events according to how you want to use it:
- OnBeforeSaveWebPageCache — The static files are written during this event; the first client to access a Resource will generate the MODX cache file and a static file that can be served directly by the web server. This event is required.
-
OnDocFormSave (v1.3.0-pl) — This event is only applicable when using the
regenerate_on_save
feature which will regenerate the static file for a Resource when changes are saved to that Resource. -
OnSiteRefresh — The
statcache_path
is cleared on this event, or, optionally in v1.3.0-pl or later, the static files are regenerated without being removed if theregenerate
property is set to Yes (1). See theregenerate
property details below for additional information on using that feature. Do not register the plugin with this event if you don't want to remove nor regenerate the static files. - OnDocUnPublished/OnResourceDelete (v1.4.0-pl) — This event is used to remove static files when a Resource is unpublished or marked for deletion.
- cacheTV (v1.3.0-pl) — Cache all Resources that have a non-empty value in the Template Variable specified in this property value by name. NOTE that this property overrides all other options; leave empty to use other options.
- skipIfTagsRemain — Skips any Resource that contains non-cacheable tags if this property is set to Yes (1). This is the default behavior.
- skipTV — Skips any Resource with a non-empty value for the Template Variable specified in this property value by name. Leave empty to only skip non-cacheable Resources.
- skipBinaryContentTypes (v1.2.0-pl) — Skip any Resource that has a binary Content Type. This is the default behavior.
- mimeTypes (v1.2.0-pl) — If specified and non-empty, only cache Resources associated with the specified mime-types by Content Type. Accepts a comma-delimited list of mime-types.
- contentTypes (v1.2.0-pl) — If specified and non-empty, only cache Resources with the specified ContentType id's. Accepts a comma-delimited list of ContentType id's.
-
regenerate (v1.3.0-pl) — Regenerate static files instead of removing them when clearing site cache. This option requires web server configuration to prevent serving the static files when a client accesses the Resource with an HTTP User-Agent header with the value specified in the
regenerate_useragent
property (MODX RegenCache
by default). -
regenerate_on_save (v1.4.0-pl) — Regenerate an existing static file when a Resource is saved in the manager. This option requires the plugin to be registered with the
OnDocFormSave
event to function and will only regenerate the file if it already exists. This option requires the same web server configuration asregenerate
does to prevent serving static files to clients that send theregenerate_useragent
value in an HTTP User-Agent header. -
regenerate_useragent (v1.4.0-pl) — The User-Agent HTTP header to send when regenerating static files. Your web server should be configured to not serve the static files when the User-Agent equals the value specified here.
MODX RegenCache
is the default value. -
use_url_scheme (v1.4.0-pl) — If enabled, the url_scheme setting without the
://
will be used as a path segment appended to thestatcache_path
in order to provide different static representations forhttp
andhttps
. -
use_http_host (v1.4.0-pl) — If enabled the http_host setting will be used as a path segment appended to the
statcache_path
in order to support multi-Context sites which use different domains or sub-domains per Context. - contexts (v1.4.0-pl) — An optional comma-delimited list of Context keys, which, if specified, will limit static caching to the Contexts specified.