File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -667,6 +667,31 @@ public function flush( $redis = true ) {
667667 return true ;
668668 }
669669
670+ /**
671+ * Removes all cache items in a group.
672+ *
673+ * @param string $group Name of group to remove from cache.
674+ * @return true Always returns true.
675+ */
676+ public function flush_group ( $ group ) {
677+ if ( ! $ this ->_should_use_redis_hashes ( $ group ) ) {
678+ return false ;
679+ }
680+
681+ $ multisite_safe_group = $ this ->multisite && ! isset ( $ this ->global_groups [ $ group ] ) ? $ this ->blog_prefix . $ group : $ group ;
682+ $ redis_safe_group = $ this ->_key ( '' , $ group );
683+ if ( $ this ->_should_persist ( $ group ) ) {
684+ $ result = $ this ->_call_redis ( 'del ' , $ redis_safe_group );
685+ if ( 1 !== $ result ) {
686+ return false ;
687+ }
688+ } elseif ( ! $ this ->_should_persist ( $ group ) && ! isset ( $ this ->cache [ $ multisite_safe_group ] ) ) {
689+ return false ;
690+ }
691+ unset( $ this ->cache [ $ multisite_safe_group ] );
692+ return true ;
693+ }
694+
670695 /**
671696 * Retrieves the cache contents, if it exists
672697 *
You can’t perform that action at this time.
0 commit comments