xPDOCacheManager.set
Last updated Apr 6th, 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.
Backers
Budget
$311 per month—let's make that $500!
Learn morexPDOCacheManager::set¶
Set a key-value pair in a cache provider.
Also allows for an array of options to be passed. The current available values are:
-
format
- If equalsXPDO_CACHE_JSON
, will set the string as the only data in file (rather than a return of the string. This is useful if you want more proper parsing of JSON data.
Syntax¶
API Docs: http://api.modxcms.com/xpdo/cache/xPDOCacheManager.html#set
boolean set (string $key, mixed &$var, [integer $lifetime = 0], [array $options = array()])
Example¶
Set a cache file to the string provided, to expire in 2 hours.
$str = 'This will be cached.';
$xpdo->cacheManager->set('mycachefile',$str,7200);
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
- xPDOCacheManager
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.
Backers
Budget
$311 per month—let's make that $500!
Learn more