Commit 413563ef authored by 赵啸非's avatar 赵啸非

修改redis 过期事件通知

parent 8099ae28
package com.mortals.xhx.base.framework.listener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;
......@@ -9,11 +10,12 @@ import org.springframework.stereotype.Component;
* @date: 2022/6/22 16:40
* @description:
**/
@Slf4j
@Component
public class CustomerKeyExpirationListener implements MessageListener {
@Override
public void onMessage(Message message, byte[] bytes) {
String key = message.toString();
System.out.println("监听到key:" + key + "过期");
log.info("监听到key:" + key + "过期");
}
}
\ No newline at end of file
......@@ -27,7 +27,7 @@ public class DemoStartService implements IApplicationService {
log.info("初始化发送线程数量");
sendTaskThreadPool.init(20);
cacheService.setnx("test-expire","111", Duration.ofMinutes(1).toMillis());
cacheService.setnx("test-expire","111", 100);
log.info("开始服务..[配置已加载完成,但部分框架还未初始化,比如:Kafka]");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment