package com.ruoyi.cai.ws.cache;

import com.ruoyi.cai.ws.constant.RedisConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class OnlineDataCache {
    @Autowired
    private StringRedisTemplate redisTemplate;

    public String getKey(){
        return RedisConstant.ONLINE_ROOM_DATA;
    }

    public void add(Long roomId){
        redisTemplate.opsForSet().add(getKey(), String.valueOf(roomId));
    }

    public void remove(Long roomId) {
        redisTemplate.opsForSet().remove(getKey(),roomId);
    }
}
