<?php
namespace WpRigel\Commandify;

defined( 'ABSPATH' ) || exit;

class Cache {

	public static function init_hooks() {
		add_action( 'activated_plugin', array( __CLASS__, 'clear' ) );
		add_action( 'deactivated_plugin', array( __CLASS__, 'clear' ) );
		add_action( 'switch_theme', array( __CLASS__, 'clear' ) );
	}

	public static function clear() {
		delete_transient( 'commandify_commands_cache' );
		delete_transient( 'commandify_popular_plugins' );
		delete_transient( 'commandify_popular_themes' );
	}
}
