Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 在逐出与@cacheexecute的regex-in-key属性匹配的特定键时,如何在SpEL中使用regex_Spring_Spring Cache - Fatal编程技术网

Spring 在逐出与@cacheexecute的regex-in-key属性匹配的特定键时,如何在SpEL中使用regex

Spring 在逐出与@cacheexecute的regex-in-key属性匹配的特定键时,如何在SpEL中使用regex,spring,spring-cache,Spring,Spring Cache,我想逐出给定缓存中以某个字符串开头的所有键 例如: 我想逐出所有缓存对象,这些对象的键以参数中传递的位置开头。 我尝试使用*quantifier,但它不起作用您可以在SpEL表达式中使用regrex,请尝试在键值中添加{},-- 这似乎不起作用,我尝试了下面的方法@cacheexecute(cacheNames=“LOCATION”,key=“#{p0*}”),但是没有发生驱逐,您是否能够实现它?请同时参考此问题 @CacheEvict(cacheNames="LOCATION", key="#

我想逐出给定缓存中以某个字符串开头的所有键 例如:

我想逐出所有缓存对象,这些对象的键以参数中传递的位置开头。
我尝试使用*quantifier,但它不起作用

您可以在SpEL表达式中使用regrex,请尝试在键值中添加
{}
,--


这似乎不起作用,我尝试了下面的方法@cacheexecute(cacheNames=“LOCATION”,key=“#{p0*}”),但是没有发生驱逐,您是否能够实现它?请同时参考此问题
@CacheEvict(cacheNames="LOCATION", key="#p0*")
public void evictLocation(String location, String type ) {
    //some code here
}
@CacheEvict(cacheNames="LOCATION", key="#{yourLocationArg*}")
public void evictLocation(String location, String type ) {
    //some code here
}