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.
Common
Name | Return | Summary | |
---|---|---|---|
$procache->allowCDN() $procache->allowCDN() $procache->allowCDN($page = null) | bool | Is CDN active/allowed for current page/request/user? | |
$procache->allowCacheForPage() $procache->allowCacheForPage(Page $page) $procache->allowCacheForPage(Page $page) | bool | Hookable 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() $procache->cacheIndexBasename() $procache->cacheIndexBasename(string $hostname = '', bool $https = null, string $ext = 'html') | string | Return the index filename relative to the given host and https state | |
$procache->cacheMaintenance() $procache->cacheMaintenance() $procache->cacheMaintenance() | (nothing) | Cache maintenance to occur every 30 seconds | |
$procache->cacheOn() $procache->cacheOn() $procache->cacheOn($set = null) | bool | Get 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() $procache->cdnUrl(string $url) $procache->cdnUrl(string $url, bool $requireExt = true) | string | Given a local URL convert to a CDN URL (if given URL is in CDN’s path space) | |
$procache->clearAll() $procache->clearAll() $procache->clearAll() | int | Clear entire cache | |
$procache->clearPage() $procache->clearPage(Page $page) $procache->clearPage(Page $page, array $options = []) | int array | Clear the cache for a specific page, including pageNum and urlSegment versions | |
$procache->clearPages() $procache->clearPages(PageArray $items) $procache->clearPages(PageArray $items, bool $getFiles = true) | array | Clear the cache for multiple pages | |
$procache->css() $procache->css($files) $procache->css($files, bool $minify = true) | string | Merge and minify the given array or CSV string of CSS, SCSS or LESS files | |
$procache->debug | bool | ||
$procache->debugInfo() $procache->debugInfo() $procache->debugInfo(string $value = '', bool $prepend = false) | array | Add or get debug info | |
$procache->debugMode() $procache->debugMode() $procache->debugMode() | bool | Use debug mode? | |
$procache->docRootPath | string | Server document root path for .htaccess file (for when %{DOCUMENT_ROOT} does not work) | |
$procache->files | ProCacheFiles | ||
$procache->get() $procache->get(string $key) $procache->get(string $key) | mixed | Return a config value | |
$procache->getBuster() $procache->getBuster() $procache->getBuster() | ProCacheBuster | Get ProCacheBuster instance | |
$procache->getCDN() $procache->getCDN() $procache->getCDN() | ProCacheCDN | Get instance of ProCacheCDN | |
$procache->getCacheClearBehaviors() $procache->getCacheClearBehaviors() $procache->getCacheClearBehaviors($options = []) | array | Get the cache clearing behaviors for all templates or a given template | |
$procache->getCachePath() $procache->getCachePath() $procache->getCachePath($page = null, array $options = []) | string | Return the path where we store cache files, optionally for a page | |
$procache->getCacheTime() $procache->getCacheTime() $procache->getCacheTime($template = null) | array int | Get the cache time for the given Template, or for all templates | |
$procache->getCompilerLESS() $procache->getCompilerLESS() $procache->getCompilerLESS() | mixed | @return ProCacheCompiler|ProCacheCompilerLeafoLESS|ProCacheCompilerWikimediaLESS | |
$procache->getCompilerSCSS() $procache->getCompilerSCSS() $procache->getCompilerSCSS() | ProCacheCompiler ProCacheCompilerSCSS | @return ProCacheCompiler|ProCacheCompilerSCSS | |
$procache->getContentTypeExt() $procache->getContentTypeExt($item) $procache->getContentTypeExt($item) | string | Get the content-type extension for the given Page or Template | |
$procache->getFileMerger() $procache->getFileMerger() $procache->getFileMerger() | ProCacheFileMerger | Get an instance of the ProCache file merger | |
$procache->getFiles() $procache->getFiles() $procache->getFiles() | ProCacheFiles | @return ProCacheFiles | |
$procache->getHooker() $procache->getHooker() $procache->getHooker() | ProCacheHooker | @return ProCacheHooker | |
$procache->getHtaccess() $procache->getHtaccess() $procache->getHtaccess() | ProCacheHtaccess | @return ProCacheHtaccess | |
$procache->getLESS() $procache->getLESS() $procache->getLESS() | lessc \Less_Parser | Get new instance of LESS compiler | |
$procache->getMinify() $procache->getMinify() $procache->getMinify() | ProCacheMinify | @return ProCacheMinify | |
$procache->getSCSS() $procache->getSCSS() $procache->getSCSS() | ScssPhp\ScssPhp\Compiler | Get new instance of SCSS compiler | |
$procache->getStatic() $procache->getStatic() $procache->getStatic() | ProCacheStatic | @return ProCacheStatic | |
$procache->getTable() $procache->getTable() $procache->getTable() | string | Get primary ProCache DB table name while also checking that schema is up-to-date | |
$procache->getTests() $procache->getTests() $procache->getTests() | ProCacheTests | @return ProCacheTests | |
$procache->getTweaks() $procache->getTweaks() $procache->getTweaks() | ProCacheTweaks | @return ProCacheTweaks | |
$procache->hasCacheFile() $procache->hasCacheFile(Page $page) $procache->hasCacheFile(Page $page, array $options = []) | bool string | Get 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() $procache->isPageCacheable(Page $page) $procache->isPageCacheable(Page $page) | bool | Is this page configured for caching in ProCache? | |
$procache->js() $procache->js($files) $procache->js($files, bool $minify = true) | string | Merge and minify the given array or CSV string of JS files | |
$procache->licenseKey | string | ||
$procache->link() $procache->link($files) $procache->link($files, bool $minify = true, string $media = '') | string | Generate an HTML stylesheet <link> tag with the given files | |
$procache->merge() $procache->merge($files) $procache->merge($files, bool $minify = true) | string | Merge the given array or csv string of files | |
$procache->minify | ProCacheMinify | ||
$procache->minifyBlocks | string | ||
$procache->minifyHTMLOptions | array | ||
$procache->minifyHtml() $procache->minifyHtml(string $out) $procache->minifyHtml(string $out, array $options = [], bool $debug = false) | bool | Minify 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() $procache->numCachedPages() $procache->numCachedPages() | int | Return the number of pages in the cache | |
$procache->pageInfo() $procache->pageInfo(Page $page) $procache->pageInfo(Page $page) | array bool | Return an info array about the given page’s ProCache info or false if not cached | |
$procache->populateCDN() $procache->populateCDN(string $content) $procache->populateCDN(string $content, string $type = 'html') | bool | Populate CDN replacements into given $content regardless of whether it’s enabled | |
$procache->renderCDN() $procache->renderCDN(Page $page, string $content) $procache->renderCDN(Page $page, string $content, string $type = 'html') | bool | Populate CDN replacements into given content if CDN enabled and allowed for given $page | |
$procache->renderCache() $procache->renderCache(Page $page, string $out) $procache->renderCache(Page $page, string $out) | bool | Save a new static cache file | |
$procache->renderMerge() $procache->renderMerge(page $page, string $out) $procache->renderMerge(page $page, string $out) | bool | Merge and minify CSS and JS file references in output | |
$procache->renderMinify() $procache->renderMinify(Page $page, string $out, bool $allowCache) $procache->renderMinify(Page $page, string $out, bool $allowCache) | bool | Minify HTML of output | |
$procache->renderPageID | int | The ID of the page currently being rendered in ProcessWire | |
$procache->schemaVersion | int | ||
$procache->script() $procache->script($files) $procache->script($files, bool $minify = true, string $type = '') | string | Generate an HTML javascript <script> tag with the given files merged | |
$procache->set() $procache->set(string $key, mixed $value) $procache->set(string $key, mixed $value) | ProCache WireData | Set 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() $procache->tmpDirCleanup() $procache->tmpDirCleanup() | int | Cleanup any 'ProCache-tmp' dirs that remain in /site/assets/ | |
$procache->tweaks | ProCacheTweaks | ||
$procache->urlSegments | int | Max URL segments to cache | |
$procache->wired() $procache->wired() $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.236