今天就跟大家聊聊有关如何分析redis模糊匹配key \xAC序列化问题,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
业务包括:企业网站建设、成都做手机网站、成都做商城网站、网站营销推广等服务,并且涵盖域名申请、网络空间、云服务器、等互联网基础服务;成都创新互联公司联建站以互联网的创新理念,成熟完善的建站体系,开拓进取的精神,专业的解决方案和顾问咨询服务,帮助客户在互联网时代提升形象、把握商机、实现价值,提高企业的核心竞争力。
1.使用StringRedisTemplate可正常操作
2.使用RedisTemplate需设置key为String序列化,不要采用默认序列化,否则无法进行模糊匹配,代码如下:
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.serializer.StringRedisSerializer; @Configuration public class RedisConfig { @Bean @ConditionalOnMissingBean(name = "redisTemplate") public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { RedisTemplate<String, Object> redisTemplate = new RedisTemplate<String, Object>(); StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); redisTemplate.setKeySerializer(stringRedisSerializer); redisTemplate.setConnectionFactory(redisConnectionFactory); return redisTemplate; } @Bean @ConditionalOnMissingBean(StringRedisTemplate.class) public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory) { StringRedisTemplate template = new StringRedisTemplate(); template.setConnectionFactory(redisConnectionFactory); return template; } }
看完上述内容,你们对如何分析redis模糊匹配key \xAC序列化问题有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。
标题名称:如何分析redis模糊匹配key\xAC序列化问题
本文来源:https://www.cdcxhl.com/article14/pjsede.html
成都网站建设公司_创新互联,为您提供虚拟主机、小程序开发、网站排名、响应式网站、网站策划、外贸网站建设
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联