$resFive = $modx->getObject('modResource',5); $cacheKey = $resFive->getCacheKey(); $modx->cacheManager->delete($cacheKey);
$resFive = $modx->getObject('modResource',5); $modx->cacheManager->refresh(array( 'db' => array(), 'auto_publish' => array('contexts' => array($resFive->get('context_key'))), 'context_settings' => array('contexts' => array($resFive->get('context_key'))), 'resource' => array('contexts' => array($resFive->get('context_key'))), ));
$resFive = $modx->getObject('modResource',5); $cacheKey = $resFive->getCacheKey(); $file = $path_to_cache.$cacheKey.'.cache.php'; //Something like: 'cache/resource/web/resources/5.cache.php unlink($file);
$modx->getCacheManager(); // harmless and sometimes necessary $modx->cacheManager->delete('resource/web/resources/5.cache.php');
<?php // This bit works fine: $cm = $modx->getCacheManager(); $resource = $modx->getObject('modResource',1); $results = $cm->generateResourceHack($resource); // This bit does not work: $cm->delete('resource/web/resources/5.cache.php');
<?php /* get the cache provider for the "resource" cache partition */ $resourceCache = $modx->cacheManager->getCacheProvider($modx->getOption('cache_resource_key', null, 'resource')); $resFive = $modx->getObject('modResource', 5); $resourceCache->delete($resFive->getCacheKey());
Fatal error: Call to undefined method modCacheManager::getProvider() in mySnippet
<?php $modx->setLogLevel(modX::LOG_LEVEL_DEBUG); $modx->log(modX::LOG_LEVEL_DEBUG, '############test create cache file'); $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From:" . $from; mail($to,$subject,$message,$headers);