I found this code in several places for clearing the cache of a single resource.
It does nothing in a plugin attached to OnBeforeDocFormSave. The code executes, but the cache file is still there. Has something changed, or am I doing something wrong?
$modx->cacheManager->delete($resource->getCacheKey(), array(
xPDO::OPT_CACHE_KEY => $modx->getOption('cache_resource_key', null, 'resource'),
xPDO::OPT_CACHE_HANDLER => $modx->getOption('cache_resource_handler', null, $modx->getOption(xPDO::OPT_CACHE_HANDLER)),
xPDO::OPT_CACHE_FORMAT => (integer)$modx->getOption('cache_resource_format', null, $modx->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP))
)
);