数据重复进库解决方案(在redis中存放key 5秒钟,存在返回,不存在添加)
IStringCache stringCache = CacheFactory.getStringCache();
Integer time = 5;
String key = "Alert_"+eventNotificationAlertJson.getString("devIndex")+eventNotificationAlertJson.getString("eventType");
if (!stringCache.exist(key)){
stringCache.set(key,eventNotificationAlert);
stringCache.setExpireTime(key,time);
}else {
return;
}
本文来自博客园,作者:年少轻狂请多指教,转载请注明原文链接:https://www.cnblogs.com/HAILAER/p/19004572
浙公网安备 33010602011771号