// 待去重 URL
public static final String[] URLS = {
“www.apigo.cn”,
“www.baidu.com”,
“www.apigo.cn”
};
@Autowired
RedisTemplate redisTemplate;
@RequestMapping("/url")
public void urlRepeat() {
for (int i = 0; i < URLS.length; i++) {
String url = URLS[i];
Long result = redisTemplate.opsForSet().add(“urlrepeat”, url);
if (result == 0) {
// 重复的 URL
System.out.println(“URL 已存在了:” + url);
}// 待去重 URL
public static final String[] URLS = {
“www.apigo.cn”,
“www.baidu.com”,
“www.apigo.cn”
};
@Autowired
RedisTemplate redisTemplate;
@RequestMapping("/url")
public void urlRepeat() {
for (int i = 0; i < URLS.length; i++) {
String url = URLS[i];
Long result = redisTemp