package com.red.circle.live.infra.listener;

import com.red.circle.component.redis.listener.RedisKeyExpiredMessageListener;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 监听Redis key 过期. 注意: 依赖系统配置notify-keyspace-events=Ex
 *
 * @author pengliang on 2023/12/25
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class TestMessageListener implements RedisKeyExpiredMessageListener {

  @Override
  public String listenerKey() {
    return "Test*";
  }

  @Override
  public void onMessage(String key) {
    log.warn("Test: {}", key);
  }

}
