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

网站开发毕业设计中期检查表南阳网站seo

网站开发毕业设计中期检查表,南阳网站seo,wordpress无法建立到wordpress.org的安全连接,网站服务器租用你的知识宝库1.技术背景,想知道 redis 设置了TTL时间的key 过期,且有后续的业务处理的场景可以使用。 bug点: 使用redis 缓存失效监听会有一定的延迟, 过期事件是在redis服务器删除键的时候生成的,而不是在理论上生存时间到达0值得…

1.技术背景,想知道 redis 设置了TTL时间的key 过期,且有后续的业务处理的场景可以使用。
bug点:
使用redis 缓存失效监听会有一定的延迟, 过期事件是在redis服务器删除键的时候生成的,而不是在理论上生存时间到达0值得时候生成的。

搭建:
1.前置条件为 redis服务器端开启了事件通知。配置文件redis.conf文件中 开启相关配置。
默认情况下redis是未开启事件通知的。

############################# EVENT NOTIFICATION ############################### Redis can notify Pub/Sub clients about events happening in the key space.
# This feature is documented at https://redis.io/topics/notifications
#
# For instance if keyspace events notification is enabled, and a client
# performs a DEL operation on key "foo" stored in the Database 0, two
# messages will be published via Pub/Sub:
#
# PUBLISH __keyspace@0__:foo del
# PUBLISH __keyevent@0__:del foo
#
# It is possible to select the events that Redis will notify among a set
# of classes. Every class is identified by a single character:
#
#  K     Keyspace events, published with __keyspace@<db>__ prefix.
#  E     Keyevent events, published with __keyevent@<db>__ prefix.
#  g     Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
#  $     String commands
#  l     List commands
#  s     Set commands
#  h     Hash commands
#  z     Sorted set commands
#  x     Expired events (events generated every time a key expires)
#  e     Evicted events (events generated when a key is evicted for maxmemory)
#  t     Stream commands
#  d     Module key type events
#  m     Key-miss events (Note: It is not included in the 'A' class)
#  A     Alias for g$lshzxetd, so that the "AKE" string means all the events
#        (Except key-miss events which are excluded from 'A' due to their
#         unique nature).
#
#  The "notify-keyspace-events" takes as argument a string that is composed
#  of zero or multiple characters. The empty string means that notifications
#  are disabled.
#
#  By default all notifications are disabled because most users don't need
#  this feature and the feature has some overhead. Note that if you don't
#  specify at least one of K or E, no events will be delivered.
#  notify-keyspace-events ""
# 配置文件修改项
notify-keyspace-events "Ex" 

可直接修改 notify-keyspace-events “Ex” 即为开启了rediss 事件监听,然后重启redis 服务(或者使用命令的形式,不需要重启redis服务)。不同key 类型的监听见上文档。

2.项目中编写相关的监听程序(前置条件,redis已经集成进项目里了)

import com.jinyi.up.user.listener.RedisKeyExpirationListener;
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.KeyExpirationEventMessageListener;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
/*** spring容器 里通过 java配置方式注入RedisMessageListenerContainer 和  KeyExpirationEventMessageListener的实现类* @author jinyi* @date 2023/11/25 16:39* @desc*/
@Configuration
public class RedisListenerConfig {@BeanRedisMessageListenerContainer listenerContainer(RedisConnectionFactory connectionFactory) {RedisMessageListenerContainer listenerContainer = new RedisMessageListenerContainer();listenerContainer.setConnectionFactory(connectionFactory);return listenerContainer;}@BeanKeyExpirationEventMessageListener redisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {return new RedisKeyExpirationListener(listenerContainer);}}
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;/*** 使用redis 缓存失效监听会有一定的延迟, 过期事件是在redis服务器删除键的时候生成的,而不是在理论上生存时间到达0值得时候生成的,** @author jinyi* @date 2023/11/25 16:40* @desc*/
@Slf4j
@Component
public class RedisKeyExpirationListener extends KeyExpirationEventMessageListener {public RedisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {super(listenerContainer);}/*** 针对redis数据失效事件,进行数据处理** @param message key的信息,并不包含缓存值。* @param pattern*/@Overridepublic void onMessage(Message message, byte[] pattern) {//获得失效的keylog.info("KeyExpiration key:" + message);//todo 后续的业务处理}}
http://www.tj-hxxt.cn/news/13265.html

相关文章:

  • wordpress搜资料百度网站的优化方案
  • 连云港做网站公司河南郑州网站顾问
  • 服务好的高端网站建设公司2022年新闻热点事件
  • 河北邢台手机网站建设竞价推广思路
  • 微信公众号免费制作成微网站网购网站十大排名
  • 网站搭建哪里找方便百度云手机app下载
  • 系统集成销售和网站建设销售百度客服24小时电话
  • 网站现状如何分析店铺推广软文范例
  • 设计相关的网站百度人工客服电话
  • 网站和app可以做充值余额功能真正免费建站网站
  • 承德网站建设开发北京seo技术交流
  • php企业网站 源码网页设计软件dreamweaver
  • 有些中小网站西安网站建设制作公司
  • 免费的黄冈网站有哪些代码外链生成器
  • 青海公路建设服务网站企业培训公司有哪些
  • 北京商城网站开发百度指数平台
  • 长沙公司网站开发深圳防疫措施优化
  • 网站ssl证书怎么做百度收录提交工具
  • 个人域名用来做淘宝客网站网店推广有哪些方法
  • 湛江免费企业建站色盲测试图免费测试
  • 建网站免费吗seo成都培训
  • 做网站关键字seo综合查询怎么用的
  • 哪个网站可以做图片链接网址关键词查询
  • 棋牌类网站怎么做如何查询百度搜索关键词排名
  • 静态网页文件的扩展名360优化大师官网
  • dedecms网站地图修改广州seo推广优化
  • 做移动端活动页面参考网站百度一下手机版
  • 怎么建设独立网站百度推广收费
  • wordpress学人的冬天seo双标题软件
  • web开发就是网站开发吗网站优化包括对什么优化