MarkupCache class

A simple way to cache segments of markup in your templates.

A simpler front end to ProcessWire's CacheFile class.

Example usage:

$mycache = $modules->get("MarkupCache"); if(!$data = $mycache->get("cityOptions")) { foreach($pages->find("template=city, sort=name") as $city) { $data .= ""; } $mycache->save($data); } echo $data;


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

Show class?     Show args?       Only hookable?    

Common

NameReturnSummary 
MarkupCache::expire()
NoneExpire the cache, automatically hooked to every $pages->save() call 
MarkupCache::get(string $uniqueName)
string boolGet cached data identified by 'uniqueName' or false if cache not available 
MarkupCache::path()
NoneGenerate the module's path, static so it can be used by the static getModuleConfigInputfields function 
MarkupCache::removeAll()
numberClears all MarkupCache files 
MarkupCache::save(string $data)
intSave the data to the cache 

Additional methods and properties

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

API reference based on ProcessWire core version 3.0.251