Commit d0da3ea2 authored by Erick Hitter's avatar Erick Hitter
Browse files

Standardized cache clearing

parent 2f019c6c
......@@ -427,8 +427,7 @@ class Events_Store extends Singleton {
$wpdb->insert( $this->get_table_name(), $job_post );
}
// Delete internal cache
wp_cache_delete( self::CACHE_KEY );
$this->flush_internal_caches();
}
/**
......@@ -463,7 +462,7 @@ class Events_Store extends Singleton {
// Delete internal cache
// Should only be skipped when deleting duplicates, as they are excluded from the cache
if ( $flush_cache ) {
wp_cache_delete( self::CACHE_KEY );
$this->flush_internal_caches();
}
return (bool) $success;
......@@ -501,6 +500,13 @@ class Events_Store extends Singleton {
return $differences;
}
/**
* Delete the cached representation of the cron option
*/
public function flush_internal_caches() {
return wp_cache_delete( self::CACHE_KEY );
}
/**
* Prevent event store from creating new entries
*
......
......@@ -135,10 +135,10 @@ function count_events_by_status( $status ) {
/**
* Flush plugin's internal caches
*
* FOR INTERNAL USE ONLY - see WP-CLI; all other cache clearance should happen through the `Events_Store` class
* FOR INTERNAL USE ONLY - see WP-CLI; all other cache clearance should happen automatically through the `Events_Store` class
*/
function _flush_internal_caches() {
return wp_cache_delete( Events_Store::CACHE_KEY );
return Events_Store::instance()->flush_internal_caches();
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment