xPDOCacheManager.get
xPDOCacheManager::get
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.
Syntax
API Docs: http://api.modxcms.com/xpdo/cache/xPDOCacheManager.html#get
mixed get (string $key, [array $options = array()])
Example
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));
See Also
- xPDOCacheManager.copyFile
- xPDOCacheManager.copyTree
- xPDOCacheManager.delete
- xPDOCacheManager.deleteTree
- xPDOCacheManager.endsWith
- xPDOCacheManager.escapeSingleQuotes
- xPDOCacheManager.get
- xPDOCacheManager.getCachePath
- xPDOCacheManager.getCacheProvider
- xPDOCacheManager.matches
- xPDOCacheManager.replace
- xPDOCacheManager.writeFile
- xPDOCacheManager.set
- xPDOCacheManager.writeTree
Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).