modResource.clearCache
Last updated not available | 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
$194 per month—let's make that $500!
Learn moremodResource.clearCache¶
Deletes this Resource's cache entries from the resource cache provider, for the given or current context: the top-level entry and the Resource entry. Afterwards OnResourceCacheUpdate is invoked with the Resource ID when running under modX.
Core never calls the method — manager processors refresh the whole resource cache of a context instead. Call it when only one Resource must be dropped.
Syntax¶
void clearCache ([string $context = ''])
-
$context(string) context key whose cache entry is dropped, by default''uses the current context
Example¶
$resource = $modx->getObject('modResource', array('id' => 5));
$resource->clearCache('web');
See Also¶
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
$194 per month—let's make that $500!
Learn more










