redis SET SMISMEMBER
操作是O(N)
时间复杂度,如果集合中元素的cardinality
比较大,那么比较慢
if(!redisTemplate.boundSetOps(key).isMember(uri.getPath())) {
redisTemplate.boundSetOps(key).add(uri.getPath());
}
//改成
redisTemplate.boundSetOps(key).add(uri.getPath());
Posted in: redis
Comments are closed.