Last updated Dec 22nd, 2019 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
$400 per month—let's make that $500!Learn more
Get a value from a cache provider by key.
Also allows for an array of options to be passed. The current available values are:
format- If equals
XPDO_CACHE_JSON, will simply get the contents of the array. This is useful if you
set()the cache with
XPDO_CACHE_JSON, to better handle JSON data.
removeIfEmpty- If set to true, will remove the cache file if it's empty. This is the default action.
API Docs: http://api.modxcms.com/xpdo/cache/xPDOCacheManager.html#get
mixed get (string $key, [array $options = array()])
Get the cache record 'test' into a string:
$test = $xpdo->cacheManager->get('test');
Get our JSON cache data called 'myjson':
$myJsonData = $xpdo->cacheManager->get('myjson',array('format' => xPDO::CACHE_JSON));