$procache API variable / ProCache class

The ultimate caching and optimization tool for ProcessWire.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the ProCache class also inherits all the methods and properties of: WireData and Wire.

Show $var?             Show args?        

Common

NameReturnSummary 
$procache->allowCDN()
boolIs CDN active/allowed for current page/request/user? 
$procache->allowCacheForPage(Page $page)
boolHookable method to allow custom rules to determine if page output should be saved to cache file for this request
$procache->assetExpireTime int Expire CSS or JS merge/minify assets after this amount of time (default=0) 
$procache->bodyClass string 
$procache->buster ProCacheBuster 
$procache->busterUrlType int 
$procache->cacheClear array Default cache clear behaviors, one or more CACHE_CLEAR_* constant values. 
$procache->cacheClearCustom string 
$procache->cacheClearOff array Default bypasses of cache clear behaviors, one or more CACHE_CLEAR_OFF_* constant values.  
$procache->cacheDir string 
$procache->cacheHosts array 
$procache->cacheIndexBasename()
stringReturn the index filename relative to the given host and https state 
$procache->cacheMaintenance()
(nothing)Cache maintenance to occur every 30 seconds 
$procache->cacheOn()
boolGet or set cache on/off status
Can also be used as property: $procache->cacheOn
 
$procache->cacheTemplates array 
$procache->cacheTime int 
$procache->cacheTimeCustom string 
$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->cdn ProCacheCDN 
$procache->cdnAttrs string 
$procache->cdnExts string 
$procache->cdnHosts string 
$procache->cdnStatus int CDN status (0=Off, 1=On for guests only, 2=On for logged-in users only, 3=On for everyone) 
$procache->cdnTemplates array 
$procache->cdnUrl(string $url)
stringGiven a local URL convert to a CDN URL (if given URL is in CDN’s path space) 
$procache->clearAll()
intClear entire cache
$procache->clearPage(Page $page)
arrayClear the cache for a specific page, including pageNum and urlSegment versions 
$procache->clearPages(PageArray $items)
arrayClear the cache for multiple pages 
$procache->css($files)
stringMerge and minify the given array or CSV string of CSS, SCSS or LESS files 
$procache->debug bool 
$procache->debugInfo()
arrayAdd or get debug info 
$procache->debugMode()
boolUse debug mode? 
$procache->docRootPath string Server document root path for .htaccess file (for when %{DOCUMENT_ROOT} does not work) 
$procache->files ProCacheFiles 
$procache->get(string $key)
mixedReturn a config value 
$procache->getBuster()
ProCacheBusterGet ProCacheBuster instance 
$procache->getCDN()
ProCacheCDNGet instance of ProCacheCDN 
$procache->getCacheClearBehaviors()
arrayGet the cache clearing behaviors for all templates or a given template 
$procache->getCachePath()
stringReturn the path where we store cache files, optionally for a page 
$procache->getCacheTime()
array intGet the cache time for the given Template, or for all templates 
$procache->getCompilerLESS()
mixed@return ProCacheCompiler|ProCacheCompilerLeafoLESS|ProCacheCompilerWikimediaLESS 
$procache->getCompilerSCSS()
ProCacheCompiler ProCacheCompilerSCSS@return ProCacheCompiler|ProCacheCompilerSCSS 
$procache->getContentTypeExt($item)
stringGet the content-type extension for the given Page or Template 
$procache->getFileMerger()
ProCacheFileMergerGet an instance of the ProCache file merger 
$procache->getFiles()
ProCacheFiles@return ProCacheFiles 
$procache->getHooker()
ProCacheHooker@return ProCacheHooker 
$procache->getHtaccess()
ProCacheHtaccess@return ProCacheHtaccess 
$procache->getLESS()
lessc \Less_ParserGet new instance of LESS compiler 
$procache->getMinify()
ProCacheMinify@return ProCacheMinify 
$procache->getSCSS()
ScssPhp\ScssPhp\CompilerGet new instance of SCSS compiler 
$procache->getStatic()
ProCacheStatic@return ProCacheStatic 
$procache->getTable()
stringGet primary ProCache DB table name while also checking that schema is up-to-date 
$procache->getTests()
ProCacheTests@return ProCacheTests 
$procache->getTweaks()
ProCacheTweaks@return ProCacheTweaks 
$procache->hasCacheFile(Page $page)
bool stringGet cache file for given Page (and options) or false if it does not exist 
$procache->hooker ProCacheHooker 
$procache->htAllow int bool Allow writing to .htaccess file? @deprecated 
$procache->htNoEx int bool Prevent example files from being created? 
$procache->htVersion int Htaccess type/version to use  
$procache->htaccess ProCacheHtaccess 
$procache->https int 
$procache->isPageCacheable(Page $page)
boolIs this page configured for caching in ProCache? 
$procache->js($files)
stringMerge and minify the given array or CSV string of JS files 
$procache->licenseKey string 
$procache->link($files)
stringGenerate an HTML stylesheet <link> tag with the given files 
$procache->merge($files)
stringMerge the given array or csv string of files 
$procache->minify ProCacheMinify 
$procache->minifyBlocks string 
$procache->minifyHTMLOptions array 
$procache->minifyHtml(string $out)
boolMinify HTML contained in $out argument 
$procache->minifyIgnoreTags string 
$procache->minifyMaxImportCSS int 
$procache->minifyOptions array 
$procache->minifyRemoveBlankAttr string 
$procache->minifyTemplates array 
$procache->noCacheCookies string 
$procache->noCacheGetVars string 
$procache->numCachedPages()
intReturn the number of pages in the cache 
$procache->pageInfo(Page $page)
array boolReturn an info array about the given page’s ProCache info or false if not cached 
$procache->populateCDN(string $content)
boolPopulate CDN replacements into given $content regardless of whether it’s enabled 
$procache->renderCDN(Page $page, string $content)
boolPopulate CDN replacements into given content if CDN enabled and allowed for given $page 
$procache->renderCache(Page $page, string $out)
boolSave a new static cache file 
$procache->renderMerge(page $page, string $out)
boolMerge and minify CSS and JS file references in output 
$procache->renderMinify(Page $page, string $out, bool $allowCache)
boolMinify HTML of output 
$procache->renderPageID int The ID of the page currently being rendered in ProcessWire 
$procache->schemaVersion int 
$procache->script($files)
stringGenerate an HTML javascript <script> tag with the given files merged 
$procache->set(string $key, mixed $value)
ProCache WireDataSet a config value 
$procache->slashUrls int Require URLs to have trailing slash? (1=yes slash, 0=either, -1=no slash) 
$procache->static ProCacheStatic 
$procache->timer null int string 
$procache->tmpDirCleanup()
intCleanup any 'ProCache-tmp' dirs that remain in /site/assets/ 
$procache->tweaks ProCacheTweaks 
$procache->urlSegments int Max URL segments to cache 
$procache->wired()
(nothing)Wired to ProcessWire instance (3.0.158+) 

Additional methods and properties

In addition to the methods and properties above, ProCache also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.168

Twitter updates

  • There’s a new modules directory on the ProcessWire site now up and running. In this post we’ll cover a few details about what’s changed and what’s new—More
    20 November 2020
  • ProcessWire 3.0.168 core updates — More
    26 October 2020
  • This week a 2nd new module for processing Stripe payments has been added to FormBuilder. Unlike our other Stripe Inputfield, this new one supports 3D Secure (SCA) payments. We’ll take a closer look at it in this post, plus a live demo— More
    16 October 2020

Latest news

  • ProcessWire Weekly #341
    In the 341st issue of ProcessWire Weekly we're going to check out the latest processwire.com blog post, introduce upcoming commercial module called NiftyPasswordsPlus, and check out a brand new site of the week. Read on!
    Weekly.pw / 21 November 2020
  • New ProcessWire modules directory
    There’s a new modules directory on the ProcessWire site now up and running. In this post we’ll cover a few details about what’s changed and what’s new.
    Blog / 20 November 2020
  • Subscribe to weekly ProcessWire news

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull