ProCache API
The ultimate caching and optimization tool for ProcessWire.
ProcessWire Pro Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Get the cache time for the given Template, or for all templates Get the cache clearing behaviors for all templates or a given template Merge and minify the given array or CSV string of CSS, SCSS or LESS file URLs Merge and minify the given array or CSV string of Javascript file URLs Generate an HTML stylesheet Merge the given array or CSV string of file URLs and returned the merged file URL Minify given HTML directly Generate an HTML Javascript Is CDN active/allowed for current page/request/user? Given a local URL convert to a CDN URL (if given URL is in CDN’s path space) Populate CDN replacements into given content string regardless of whether it’s enabled Populate CDN replacements into given content string but only if CDN is enabled and allowed for given $page Clear entire cache Clear the cache for a specific page (including pageNum and urlSegment versions) Clear the cache for multiple pages Cleanup any 'Pro Get Pro Get instance of Pro Get instanceof LESS compiler Get instance of SCSS/SASS compiler Get an instance of the Pro Get instance of Pro Get instance of Pro Get instance of Pro Get instance of Pro Get instance of Pro Get instance of Pro Get instance of Pro Get instance of Pro Record error to javascript console (console.error) Log message to javacript console (console.log) Add or get debug info Is Pro In addition to the methods and properties above, ProPro class also inherits all the methods and properties of: WireData and Wire.Status
Origin
Name Return Summary $procache->cacheHosts array Host names that should be cached separately.
DEFAULT: [] $procache->cacheTemplates array IDs of templates where caching is enabled.
DEFAULT: [] $procache->docRootPath string Server document root path for .htaccess file for when %{DOCUMENT_ROOT} does not work $procache->https int Cache https and http requests separately, specify 1 or true for yes or 0 or false for no.
DEFAULT: 0 $procache->urlSegments int Max URL segments to cache
DEFAULT: 0 Lifespan
Name Return Summary $procache->cacheTime int Default lifetime of cache files in seconds
DEFAULT: 3600 $procache->cacheTimeCustom string Custom cache time settings per template, as specified in Pro array int string Behavior
Name Return Summary $procache->cacheClear array Default cache clear behaviors, one or more CACHE_CLEAR_* constant values. $procache->cacheClearCustom string Custom settings for cache clearing as specified in the Pro $procache->cacheClearOff array Default bypasses of cache clear behaviors, one or more CACHE_CLEAR_OFF_* constant values. array Bypass
Name Return Summary $procache->noCacheCookies string bool Disable use of cache when these cookie names are present. Newline separated list of cookie names, or boolean false for default which represents current logged-in cookies.
DEFAULT: false $procache->noCacheGetVars string Newline separated list of GET variable names that skip the cache or * for any
DEFAULT: * Minify
Name Return Summary $procache->assetExpireTime int Expire CSS or JS merge/minify assets after this amount of time
DEFAULT: 0 string string string<link> tag with the given CSS/LESS/SCSS file URLs string $procache->minify Pro Access methods from Pro $procache->minifyBlocks string HTML tags to treat as block level elements for collapsing whitespace.
DEFAULT: p h1 h2 h3 h4 div pre more… $procache->minifyHTML Pro Access methods from Pro $procache->minifyHTMLOptions array Addititional minify HTML options/toggles as specified in Pro bool $procache->minifyIgnoreTags string Space separated HTML tags that should be ignored during HTML minification
DEFAULT: textarea pre svg $procache->minifyMaxImportCSS int Max kilobytes to allow for files encoded directly into the CSS
DEFAULT: 5 $procache->minifyOptions array Minify options/toggles: htmlGuest, htmlUsers, htmlCache, jsHead, jsBody, cssHead, useTemplates $procache->minifyRemoveBlankAttr string Space separated HTML attribute names that when blank may be removed
DEFAULT: class dir for id lang style title $procache->minifyTemplates array IDs of templates where HTML minify is enabled.
DEFAULT: [] string<script> tag with the given files merged CDN
Name Return Summary bool $procache->cdn Pro Access methods from Pro $procache->cdnAttrs string Space-separated HTML attributes that can contain URLs that should be converted to CDN. .
DEFAULT: src srcset href $procache->cdnExts string Space-separated rile extensions that should be delivered by the CDN, or blank for all file extension.
DEFAULT: css js jpg jpeg gif png svg webp $procache->cdnHosts string One or more lines of: “/path/=your.cdn.com”, where “/path/” is the local starting path (pull origin) you want served by the CDN (typically /site/), and “your.cdn.com” is the CDN hostname (and optionally path) you want to map those assets to. $procache->cdnStatus int CDN status (0=Off, 1=On for guests only, 2=On for logged-in users only, 3=On for everyone)
DEFAULT: 0 $procache->cdnTemplates array Template IDs used by pages that should have assets delivered by CDN or empty for all applicable
DEFAULT: [] string bool bool Buster
Name Return Summary $procache->buster Pro Access methods from Pro $procache->busterUrlType string Buster URL type: A=/url/to/file.ext?version, B=/url/to/file.ext?v=version, C=/url/to/file.version.ext
DEFAULT: A Tweaks
Name Return Summary $procache->bodyClass string Class name to add to class attribute of <body> tag when cache is enabled
DEFAULT: Pro $procache->canonical int string Use canonical link tag? 0 No, 1 Yes with current scheme, http Yes w/HTTP scheme, https Yes w/HTTPS scheme $procache->debug bool Enable Pro
DEFAULT: false $procache->htNoEx int bool Prevent example .htaccess files from being created?
DEFAULT: false $procache->htVersion int Htaccess type/version to use. 1=original/long, 2=short
DEFAULT: 2 $procache->noMaintenance bool Set to true at runtime to prevent maintenance from running when it usually does.
DEFAULT: false $procache->scssType string SCSS compiler to use: 'leafo-1.11.0', 'leafo-1.12.1', 'leafo-2.0.1' or blank for auto $procache->slashUrls int Require URLs to have trailing slash? 1 yes slash, 0 either, -1 no slash $procache->tweaks Pro Access methods from Pro Clearing
Name Return Summary $procache->cacheClear array Default cache clear behaviors, one or more CACHE_CLEAR_* constant values. $procache->cacheClearCustom string Custom settings for cache clearing as specified in the Pro intint array array int int Helpers
Name Return Summary $procache->buster Pro Access methods from Pro $procache->cdn Pro Access methods from Pro $procache->files Pro Access methods from Pro Pro Pro mixed Pro Pro Pro Pro Pro Pro Pro Pro Pro Pro $procache->hooker Pro Access methods from Pro $procache->htaccess Pro Access methods from Pro $procache->minify Pro Access methods from Pro $procache->minifyHTML Pro Access methods from Pro $procache->static Pro Access methods from Pro $procache->tests Pro Get instance of Pro $procache->tweaks Pro Access methods from Pro Debug
Name Return Summary array array array bool Properties
Name Return Summary $procache->minifyVersion string Minifier version to use, one of "legacy" or "latest"
DEFAULT: legacy Constants
Name Return Summary Pro 1 Cache clear: clear children Pro 7 Cache clear: Family (page, parent, siblings, children, grandchildren, and so on…) Pro 3 Cache clear: clear homepage Pro 9 Cache clear: No self (overrides CACHE_CLEAR_SELF) Pro 3 Cache clear off: Do not clear cache when page is saved from API rather than interactive/admin Pro 2 Cache clear off: Do not clear cache when system page is saved Pro 1 Cache clear off: Do not clear cache when saved page uses template not itself configured for Pro Pro 5 Cache clear: clear specific page IDs Pro 2 Cache clear: clear all parents, except homepage Pro 8 Cache clear: Page references that refer to page Pro 11 Cache clear: Pages that page has references to
Note: Values above 9 should use the same double digits, i.e. 11, 22, 33 Pro 6 Cache clear: clear pages matching selector Pro 0 Cache clear: clear self (note: this is always assumed) Pro 4 Cache clear: clear entire site Pro 3 CDN statuses: Enabled for everyone Pro 1 CDN statuses: Enabled for guest users only (disalbed for logged in users) Pro 0 CDN statuses: OFF Pro 2 CDN statuses: Enabled for logged-in users only Pro 30 Number of seconds between maintenance runs Pro 1000 Max number of URL-based page numbers that are supported per page (where template allows) Pro 3.0.200 Minimum ProcessWire version to run Pro Additional methods and properties
API reference based on ProcessWire core version 3.0.253