赞
踩
基于监听key过期实现的延迟队列实现,这里需要继承KeyspaceEventMessageListener类来实现监听redis键过期
public class KeyExpirationEventMessageListener extends KeyspaceEventMessageListener implements ApplicationEventPublisherAware { private static final Topic KEYEVENT_EXPIRED_TOPIC = new PatternTopic("__keyevent@*__:expired"); private @Nullable ApplicationEventPublisher publisher; /** * Creates new {@link MessageListener} for {@code __keyevent@*__:expired} messages. * * @param listenerContainer must not be {@literal null}. */ public KeyExpirationEventMessageListener(RedisMessageListenerContainer listenerContainer) { super(listenerContainer); } /* * (non-Javadoc) * @see org.springframework.data.redis.listener.KeyspaceEventMessageListener#doRegister(org.springframework.data.redis.listener.RedisMessageListenerContainer) */ @Override protected void doRegister(RedisMessageListenerContainer lis
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。