Completed
Pull Request — develop (#1328)
by Naveen
03:01
created

Cached_Term_count_Manager   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect_hook() 0 11 1
1
<?php
2
3
namespace Wordlift\Vocabulary\Data\Term_Count;
4
/**
5
 * This class removes all the cache for the term count if the analysis is done for new tags
6
 * @since 3.30.0
7
 */
8
class Cached_Term_count_Manager {
9
10
	public function connect_hook() {
11
12
		add_action( 'wordlift_vocabulary_analysis_complete_for_terms_batch', function () {
13
			delete_transient( Cached_Term_Count::TRANSIENT_KEY );
14
		} );
15
16
		add_action('created_post_tag', function () {
17
			delete_transient( Cached_Term_Count::TRANSIENT_KEY );
18
		});
19
20
	}
21
22
}