Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用jetcache时,其他没加@cache注解的接口会污染到加了@cache的接口是什么原因? #925

Open
devs5638 opened this issue Sep 11, 2024 · 0 comments

Comments

@devs5638
Copy link

devs5638 commented Sep 11, 2024

我的代码

`

/**
* 获取配置
*/
@PostMapping("/mix")
@cached(name = "PublicController.mix", expire = 60, cacheType = CacheType.LOCAL)
@CachePenetrationProtect
public ResponseResult mix() {

    CheckValidateConfigDTO objConfig = ApolloUtils.parseObject(ApolloConstants.UPEX_MIX_NAME_SPACE, ApolloConstants.CHECK_VALIDATE_CONFIG, CheckValidateConfigDTO.class);
    HashMap<Object, Object> resultMap = Maps.newHashMap();
    JSONObject jsonObject = ApolloUtils.getObjConfig(ApolloConstants.UPEX_MIX_NAME_SPACE, ApolloConstants.WAF_CONFIG_PRE, JSONObject.class);

    JSONObject config = objConfig.getConfig();
    config.put("channelName", "geetest");
    resultMap.put("validate", config);
    resultMap.put("wafConfig", jsonObject);
    log.info("public config resultMap:{}", JSON.toJSONString(resultMap));
    return ResultUtils.success(resultMap);

}

/**
 * 获取配置
 */
@PostMapping("/mixV2")
public ResponseResult mixV2() {

    CheckValidateConfigDTO objConfig = ApolloUtils.parseObject(ApolloConstants.UPEX_MIX_NAME_SPACE, ApolloConstants.CHECK_VALIDATE_CONFIG, CheckValidateConfigDTO.class);
    HashMap<Object, Object> resultMap = Maps.newHashMap();
    JSONObject jsonObject = ApolloUtils.getObjConfig(ApolloConstants.UPEX_MIX_NAME_SPACE, ApolloConstants.WAF_CONFIG_PRE, JSONObject.class);

    JSONObject config = objConfig.getConfig();
    config.put("channelName", "aliyun");
    resultMap.put("validate", config);
    resultMap.put("wafConfig", jsonObject);
    log.info("public configV2 resultMap:{}", JSON.toJSONString(resultMap));
    return ResultUtils.success(resultMap);

}

`

这里先多次调用mixV2接口,再调用mix接口,返回结果channelName竟然偶然会返回aliyun,请问是否在使用apollo的时候触发了jetcache的bug?
{
"code": "00000",
"data": {
"validate": {
"channelName": "aliyun",
"loginNewNeedValidate": true
},
"wafConfig": {
"open": true,
"integrationUrl": "https://xxxxx"
}
},
"msg": "success",
"requestTime": "1726039268846"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant