Skip to content

Instantly share code, notes, and snippets.

@cesarmiquel
Last active August 10, 2016 16:18
Show Gist options
  • Save cesarmiquel/3e20b2f038ac7090d8167e9b55f79838 to your computer and use it in GitHub Desktop.
Save cesarmiquel/3e20b2f038ac7090d8167e9b55f79838 to your computer and use it in GitHub Desktop.
Clear de caches
<?php
/**
* Implements hook_cement_publish_page()
*/
function site_home_cement_publish_page($pid, $rev) {
// Hacer un clear cache de home y vivo del cache de paginas
$domains = variable_get('varnish_front_domains', 'desa.eldoce.tv eldoce.tv');
foreach(explode(' ', $domains) as $domain) {
$cid = 'http://' . trim($domain) . '/';
cache_clear_all($cid, 'cache_page', FALSE);
}
cache_clear_all(url('vivo', array('absolute' => TRUE)), 'cache_page', TRUE);
// hacer un clear cache de los bloques del vivo
cache_clear_all("site_vivo:", "cache_block", TRUE);
// Si est prendido varnish y expire, disparar un expire a Varnish
if (module_exists('expire') && module_exists('varnish')) {
ExpireAPI::executeExpiration(array('/ajax/site_vivo/get_content', '', '/vivo'));
// Purgamos varnish y cache_page
ExpireAPI::executeExpiration(ExpireAPI::getFrontPageUrls());
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment