diff --git a/includes/Traits/ObjectCache.php b/includes/Traits/ObjectCache.php index ff02053ac2..2fdb8e1916 100644 --- a/includes/Traits/ObjectCache.php +++ b/includes/Traits/ObjectCache.php @@ -7,7 +7,7 @@ * * Handles Caching underneath functionalities with the help of this Cacheable trait. * - * @since 3.3.2 + * @since 3.3.2 * * @package WeDevs\Dokan\Abstracts\Traits */ @@ -129,7 +129,7 @@ public static function delete( $key, $group = '', $time = 0 ) { if ( empty( $key ) ) { return false; } - + return wp_cache_delete( $key, $group, $time ); } @@ -143,24 +143,29 @@ public static function delete( $key, $group = '', $time = 0 ) { * * @since 3.3.2 * - * @param string $group Group of cache to clear. + * @param string $group Group of caches to clear. * * @return bool */ public static function invalidate_group( $group ) { $group = static::get_cache_group_with_prefix( $group ); + $supported = wp_cache_supports( 'flush_group' ); + if ( $supported ) { + wp_cache_flush_group( $group . '_prefix' ); + } + return wp_cache_set( $group . '_prefix', static::get_time_prefix(), $group ); } /** * Get Cache Key and Group with Prefix added. * - * @param string $key - * @param string $group - * * @since 3.3.2 * + * @param string $key + * @param string $group + * * @return array */ private static function get_key_and_group( $key, $group ) {