package com.red.circle.other.infra.database.cache.service.other.impl;

import com.red.circle.component.redis.service.RedisService;
import com.red.circle.other.infra.database.cache.key.LiveVoicePublicRoomKeys;
import com.red.circle.other.infra.database.cache.service.other.LiveVoicePublicRoomCacheService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 区域公共房间
 *
 * @author zongpubin on 2024/2/20
 */
@Service
@RequiredArgsConstructor
public class LiveVoicePublicRoomCacheServiceImpl implements LiveVoicePublicRoomCacheService {

  private final RedisService redisService;

  @Override
  public void setLiveVoicePublicRoomData(String regionCode, String sysOrigin, String roomId) {
    redisService.setString(
        LiveVoicePublicRoomKeys.PUBLIC_ROOM_ID.getKey(sysOrigin + "_" + regionCode),
        roomId);
  }

  @Override
  public String getLiveVoicePublicRoomData(String regionCode, String sysOrigin) {
    return redisService.getString(
        LiveVoicePublicRoomKeys.PUBLIC_ROOM_ID.getKey(sysOrigin + "_" + regionCode));
  }
}
