当前位置: 首页 > news >正文

建设信用购物网站网站常用配色

建设信用购物网站,网站常用配色,网站订单系统模板下载,公司装修开工仪式吉利话项目中常常会碰到这样的需求#xff0c;用户下订单后#xff0c;30分钟未完成自动取消订单的功能。有人说这个简单呀#xff0c;写个定时任务就搞定了。除了定时任务之外#xff0c;难道就没有其他的方法来实现吗#xff1f;有--Redis 的键空间通知事件。在Redis 2.8.0之后…项目中常常会碰到这样的需求用户下订单后30分钟未完成自动取消订单的功能。有人说这个简单呀写个定时任务就搞定了。除了定时任务之外难道就没有其他的方法来实现吗有--Redis 的键空间通知事件。在Redis 2.8.0之后提供Keyspace Notifications功能当我们将key,value键值对使用Redis缓存并设置缓存失效时间的时候会触发Redis的键事件通知客户端订阅这个通知服务端将会把对应的通知事件发送给客户端客户端收到通知然后根据自己的不同业务进行处理。要注意的是因为Redis的发布订阅模式采用的是发送即忘的策略当订阅的客户端断线时会丢失所有在断线期间发送给他的事件通知。当你的程序需要一个可靠的事件通知时Redis的键空间通知就不适合了。事件类型键空间通知都会发送两种不同类型的事件消息keyspace 和 keyevent。以 keyspace 为前缀的频道被称为键空间通知key-space notification 而以 keyevent 为前缀的频道则被称为键事件通知key-event notification。开启配置修改Redis的redis.conf# notify-keyspace-events Ex # By default all notifications are disabled because most users dont need # this feature and the feature has some overhead. Note that if you dont # specify at least one of K or E, no events will be delivered. notify-keyspace-events Ex键空间通知通常是不启用的因为这个过程会产生额外消耗。所以在使用该特性之前请确认一定是要用这个特性的然后修改配置文件# K 键空间通知以__keyspacedb__为前缀 # E 键事件通知以__keyseventdb__为前缀 # g del , expipre , rename 等类型无关的通用命令的通知, ... # $ String命令 # l List命令 # s Set命令 # h Hash命令 # z 有序集合命令 # x 过期事件每次key过期时生成 # e 驱逐事件当key在内存满了被清除时生成 # A g$lshzxe的别名因此”AKE”意味着所有的事件springboot 中的处理方式添加Redis 消息监听的配置import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.listener.RedisMessageListenerContainer;/*** ClassName RedisListenerConfig* Description* Author ZhaoDeLin* Date 2019/9/16 15:15* Email: casablanca523163.com**/ Configuration public class RedisListenerConfig {BeanRedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {RedisMessageListenerContainer container new RedisMessageListenerContainer();container.setConnectionFactory(connectionFactory);return container;} } 添加Redis key过期事件的监听import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.connection.Message; import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; import org.springframework.data.redis.listener.RedisMessageListenerContainer; import org.springframework.stereotype.Component; import javax.annotation.Resource;/*** ClassName RedisKeyExpirationListener* Description 监听redis的过期事件* Author ZhaoDeLin* Date 2019/9/16 15:18* Email: casablanca523163.com**/ Component Slf4j public class RedisKeyExpirationListener extends KeyExpirationEventMessageListener {public RedisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {super(listenerContainer);}public void onMessage(Message message, byte[] pattern){String expiredKey message.toString();log.info(redis key过期{},expiredKey);//业务逻辑处理。。。} }
http://www.huolong8.cn/news/58611/

相关文章:

  • 福建建设执业注册管理中心网站wordpress内嵌视频
  • 做楼房信息网站的作用大连网站制作案例
  • 如何提高网站的知名度苏州网站建设软件
  • access网站开发郑州设计公司
  • 公司网站服务类型怎么填网站导航的建设模板
  • 开发一个定制的网站外包网站开发合同
  • 玉林建设银行网站企业展示网站模板
  • 江东外贸seo网站建设wordpress新主题去版权
  • p2p网上贷款网站建设方案好玩的电脑网页游戏
  • 做网站遇到各种问题wordpress2014
  • 义乌网站开发公司跨境电商开发
  • 网站规划建设前期规划方案科技公司 网站 石家庄
  • 计算机开发工具有哪些做神马网站优化排名软
  • 网站建设与管理的就业方向企业推广怎么做
  • 活动汪活动策划网站深圳装修设计公司排名
  • 苏州专业做网站较好的公司有哪些延安网站开发
  • 多个域名绑定同一网站企业网站优化设计应该把什么放在首位
  • 济南长兴建设集团有限公司网站优品ppt模板网官网
  • 维护网站一年多少钱公司注册地址异常
  • 如何介绍设计的网站知名企业文化案例
  • 监控做直播网站网站开发员属于
  • 电商网站开发人员黄页推广引流网站
  • 网站做多长时间才会成功网站建设方案报价费用明细价格
  • 女人学ui有前途吗seo公司培训
  • 重庆家居网站制作公司湖南建筑信息网平台
  • 设计网站排行wordpress管理密码
  • 网站301是什么意思单一网页开发
  • 网站背景图片素材建筑工程挂网甩浆
  • 郑州 网站建设WordPress文章图片采集插件
  • 狮山网站建设wordpress form插件