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()
None

Expire the cache, automatically hooked to every $pages->save() call

 
MarkupCache::get(string $uniqueName)
string bool

Get cached data identified by 'uniqueName' or false if cache not available

 
MarkupCache::path()
None

Generate the module's path, static so it can be used by the static getModuleConfigInputfields function

 
MarkupCache::removeAll()
number

Clears all MarkupCache files

 
MarkupCache::save(string $data)
int

Save 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.253