cache = $cache; } public function register() { add_action( 'artbees_qv/settings/replaced', array( $this, 'invalidate' ) ); add_action( 'save_post_product', array( $this, 'invalidate' ) ); add_action( 'set_object_terms', array( $this, 'terms' ), 10, 4 ); add_action( 'added_term_meta', array( $this, 'term_meta' ), 10, 4 ); add_action( 'updated_term_meta', array( $this, 'term_meta' ), 10, 4 ); } public function invalidate() { $this->cache->invalidate(); } public function terms( $object_id, $terms, $tt_ids, $taxonomy ) { if ( 'product_cat' === $taxonomy ) { $this->cache->invalidate(); } } public function term_meta( $meta_id, $term_id, $key ) { if ( '_artbees_qv_visibility' === $key || '_artbees_qv_include_descendants' === $key ) { $this->cache->invalidate(); } } }