错误1:因为接口没有入参,在key中使用的固定的字符串,使用时报错SpelEvaluationException。
org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'all' cannot be found on object of type 'com.alicp.jetcache.anno.method.SpringCacheInvokeContext' - maybe not public or not valid?
解决:使用字符串时需要加上''
@Cached(name = xxx, key = "'all'"...)
问题2:当入参是"result"时,缓存不生效
@Cached(name = BANNER_INVEST_CLUES, key = "#result", expire = 5 * ONE_MINUTE, postCondition = "result.size != 0")
public List<InvestCluesRespDto> handleInfoClue(String result) {
...
}
解决:不要用result
有没有大神能解释下是什么原因