大家都用redis放数据,也都知道使用“:”号分隔不同维度的数据,那么业务场景需要区分每个维度的统计的时候,或者要根据某个key的前缀匹配去统计有多少个类似的key的时候,就要使用模糊匹配了。
先看看下面两种匹配方式:
Keys:
Match:
@RequestMapping("/match")
public void match(){
List<String> keyResultList = new ArrayList<>();
System.out.println("开始时间:"+System.currentTimeMillis());
try {
redisTemplate.execute((RedisCallback<Set