Skip to content

Instantly share code, notes, and snippets.

@nawawi
Last active December 26, 2024 11:30
Show Gist options
  • Save nawawi/b5a127989b38678f6260428bb1c13121 to your computer and use it in GitHub Desktop.
Save nawawi/b5a127989b38678f6260428bb1c13121 to your computer and use it in GitHub Desktop.
docketcache_flush_daily.php
<?php
// Place this code in wp-content/mu-plugins/docketcache_flush_daily.php
add_action('docketcache/init', function($docket_cache_instance) {
$docket_cache = $docket_cache_instance;
add_action('docketcache_flush_daily', function() use($docket_cache) {
$result = $docket_cache->flush_cache(true);
$docket_cache->co()->lookup_set('occacheflushed', $result);
do_action('docketcache/action/flush/objectcache', $result);
});
if (!wp_next_scheduled('docketcache_flush_daily')) {
wp_schedule_event(time(), 'daily', 'docketcache_flush_daily');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment