|
|
@@ -12,7 +12,7 @@ import java.util.*;
|
|
|
* @createTime 2022年08月18日 19:05:00
|
|
|
*/
|
|
|
public class ImRoomOperator {
|
|
|
- private RBitSet msgKeySet;
|
|
|
+ private RBloomFilter<String> msgKeyFilter;
|
|
|
private RAtomicLong atomicLong;
|
|
|
private final String id;
|
|
|
private final RedissonClient redissonClient;
|
|
|
@@ -24,7 +24,7 @@ public class ImRoomOperator {
|
|
|
|
|
|
public ImRoomOperator(String id, RedissonClient redissonClient, long maxSort,List<String> userIds) {
|
|
|
this.id=id;
|
|
|
- this.msgKeySet = redissonClient.getBitSet("im:msg-key."+id);
|
|
|
+ this.msgKeyFilter = redissonClient.getBloomFilter("im:msg-key."+id);
|
|
|
this.atomicLong = redissonClient.getAtomicLong("im:incr." + id);
|
|
|
this.redissonClient=redissonClient;
|
|
|
userIds
|
|
|
@@ -47,12 +47,9 @@ public class ImRoomOperator {
|
|
|
* @param key
|
|
|
* @return void
|
|
|
*/
|
|
|
- public void remarkUnreadMsg(String userId,Long key){
|
|
|
- unReadMap.forEach((id,bitSet)->{
|
|
|
- if(!userId.equals(id)){
|
|
|
- bitSet.add(String.valueOf(key));
|
|
|
- }
|
|
|
- });
|
|
|
+ public void remarkUnreadMsg(String userId,List<Long> key){
|
|
|
+ unReadMap.get(userId)
|
|
|
+ .removeAll(key);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -113,12 +110,12 @@ public class ImRoomOperator {
|
|
|
* @param key
|
|
|
* @return boolean
|
|
|
*/
|
|
|
- public boolean existMsg(Long key){
|
|
|
- return msgKeySet.get(key);
|
|
|
+ public boolean existMsg(String key){
|
|
|
+ return msgKeyFilter.contains(key);
|
|
|
}
|
|
|
|
|
|
public void close(){
|
|
|
- msgKeySet.deleteAsync();
|
|
|
+ msgKeyFilter.deleteAsync();
|
|
|
atomicLong.deleteAsync();
|
|
|
unReadMap.forEach((k,bitSet)->{
|
|
|
if (bitSet.size()==0) {
|