@GetMapping("/cleanPlugin")
    public Mono<String> cleanPlugin(@RequestParam("name") final String name) {
        LOG.info("clean apache shenyu local plugin for {}", name);
        BaseDataCache.getInstance().removePluginDataByPluginName(name);
        List<SelectorData> selectorData = Optional.ofNullable(BaseDataCache.getInstance().obtainSelectorData(name)).orElse(Collections.emptyList());
        final List<SelectorData> newSelectorData = CollectionUtils.isNotEmpty(selectorData) ? Lists.newArrayList(selectorData) : Collections.emptyList();
        final List<String> selectorIds = newSelectorData.stream().map(SelectorData::getId).collect(Collectors.toList());
        BaseDataCache.getInstance().removeSelectDataByPluginName(name);
        // remove selector and rule l1 cache
        MatchDataCache.getInstance().removeSelectorData(name);
        MatchDataCache.getInstance().removeRuleData(name);
        ShenyuTrie selectorTrie = SpringBeanUtils.getInstance().getBean(TrieCacheTypeEnum.SELECTOR.getTrieType());
        ShenyuTrie ruleTrie = SpringBeanUtils.getInstance().getBean(TrieCacheTypeEnum.RULE.getTrieType());
        ShenyuConfig shenyuConfig = SpringBeanUtils.getInstance().getBean(ShenyuConfig.class);
        // remove selector trie cache
        if (Boolean.TRUE.equals(shenyuConfig.getSelectorMatchCache().getTrie().getEnabled())) {
            newSelectorData.forEach(selector -> {
                List<ConditionData> conditionDataList = selector.getConditionList();
                if (CollectionUtils.isNotEmpty(conditionDataList)) {
                    List<ConditionData> filterConditions = conditionDataList.stream()
                            .filter(conditionData -> ParamTypeEnum.URI.getName().equals(conditionData.getParamType()))
                            .collect(Collectors.toList());
                    if (CollectionUtils.isNotEmpty(filterConditions)) {
                        List<String> uriPaths = filterConditions.stream().map(ConditionData::getParamValue).collect(Collectors.toList());
                        selectorTrie.remove(uriPaths, selector, TrieCacheTypeEnum.SELECTOR);
                    }
                }
            });
        }
        // remove rule trie cache
        for (String selectorId : selectorIds) {
            List<RuleData> ruleDataList = BaseDataCache.getInstance().obtainRuleData(selectorId);
            List<RuleData> newRuleDataList = CollectionUtils.isNotEmpty(ruleDataList) ? Lists.newArrayList(ruleDataList) : Collections.emptyList();
            BaseDataCache.getInstance().removeRuleDataBySelectorId(selectorId);
            if (Boolean.TRUE.equals(shenyuConfig.getRuleMatchCache().getTrie().getEnabled())) {
                if (CollectionUtils.isNotEmpty(newRuleDataList)) {
                    newRuleDataList.forEach(rule -> {
                        List<ConditionData> conditionDataList = rule.getConditionDataList();
                        if (CollectionUtils.isNotEmpty(conditionDataList)) {
                            List<ConditionData> filterConditions = conditionDataList.stream()
                                    .filter(conditionData -> ParamTypeEnum.URI.getName().equals(conditionData.getParamType()))
                                    .collect(Collectors.toList());
                            if (CollectionUtils.isNotEmpty(filterConditions)) {
                                List<String> uriPaths = filterConditions.stream().map(ConditionData::getParamValue).collect(Collectors.toList());
                                ruleTrie.remove(uriPaths, rule, TrieCacheTypeEnum.RULE);
                            }
                        }
                    });
                }
            }
        }
        return Mono.just(Constants.SUCCESS);
    }
@Test
    public void testCleanPlugin() throws Exception {
        final String testCleanPluginName = "testCleanPluginName";
        subscribePluginForTest(testCleanPluginName);
        subscribeSelectorForTest(testCleanPluginName);
        final MockHttpServletResponse response = this.mockMvc.perform(MockMvcRequestBuilders.get("/shenyu/cleanPlugin")
                .param("name", testCleanPluginName))
                .andReturn()
                .getResponse();
        assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
        assertThat(baseDataCache.obtainPluginData(testCleanPluginName)).isNull();
        assertThat(baseDataCache.obtainSelectorData(testCleanPluginName)).isNull();
    }