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

上海建设银行网站查询余额那个网站可以做考卷

上海建设银行网站查询余额,那个网站可以做考卷,h5活动页面制作,WordPress模块置顶应用场景 存放Token、存放用户信息或字典等需要频繁访问数据库获取但不希望频繁访问增加数据库压力且变化不频繁的数据。 集成步骤 1. 新建 Maven 项目并引入 redis 依赖【部分框架有可能已经集成#xff0c;会导致依赖文件有差异】 dependencygroupIdorg…应用场景 存放Token、存放用户信息或字典等需要频繁访问数据库获取但不希望频繁访问增加数据库压力且变化不频繁的数据。 集成步骤 1. 新建 Maven 项目并引入 redis 依赖【部分框架有可能已经集成会导致依赖文件有差异】 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-data-redis/artifactId /dependency2. 配置 application.yml文件 #数据源配置 spring:redis:##redis 单机环境配置# Redis服务器地址host: 127.0.0.1# Redis服务器连接端口port: 6379password:# Redis数据库索引默认为0database: 0ssl: falsedatasource:url: jdbc:mysql://*.***.**.**:3516/smart_order?useSSLfalseuseUnicodetruecharacterEncodingutf-8zeroDateTimeBehaviorconvertToNulltransformedBitIsBooleantrueserverTimezoneGMT%2B8nullCatalogMeansCurrenttrueallowPublicKeyRetrievaltrueusername: rootpassword: ******3. 编写缓存服务和Controller spring-boot 自动配置了 RedisConnectionFactory, StringRedisTemplate 和 RedisTemplate Bean。 默认连接的 redis 服务端为 localhost:6379CacheService 接口 /*** 缓存服务* param K 缓存的 key* param V 缓存的内容*/ public interface CacheServiceK,V {Boolean cache(K key, V value);Boolean remove(K key);V get(K key);}RedisCacheService import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service;/*** 基于 Redis 实现的的缓存服务*/ Service(redisCacheService) public class RedisCacheService implements CacheServiceString, Object{// spring-boot 自动配置了 RedisConnectionFactory, StringRedisTemplate 和 RedisTemplate Bean。Autowiredprivate RedisConnectionFactory connectionFactory;Autowiredprivate StringRedisTemplate template;AutowiredQualifier(redisTemplate)private RedisTemplate redisTemplate;Overridepublic Boolean cache(String key, Object value) {template.opsForValue().set(key,String.valueOf(value));return Boolean.TRUE;}Overridepublic Boolean remove(String key) {return template.delete(key);}Overridepublic Object get(String key) {return template.opsForValue().get(key);} }CacheController import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController;/*** CacheController 用于提供 接口进行缓存操作*/ RestController RequestMapping(/cache) public class CacheController {AutowiredQualifier(redisCacheService)private CacheService cacheService;/*** 缓存* param key* param value* return*/GetMapping(/save)public Boolean cache(RequestParam(key) String key, RequestParam(value)String value){return cacheService.cache(key,value);}/*** 查询* param key 缓存key* return*/GetMapping(/get)public Object get(RequestParam(key) String key){return cacheService.get(key);}/*** 删除缓存* param key 缓存key* return*/GetMapping(/remove)public Boolean remove(RequestParam(key) String key){return cacheService.remove(key);} }4. 下载redis并打开 Redis3.0下载地址https://redis.io/download/解压后打开其中的redis-server.exe即可。 5. 启动项目并测试 在SpirngBoot测试类中先用Autowired引入RedisCache。通过调用该对象的方法来操作redis数据库。 Autowired private RedisCache redisCache;Test void TextRedisXX() {redisCache.setCacheObject(hhh, 123);String str redisCache.getCacheObject(hhh);System.out.println(str); }亦或是容器初始化时获取 StringRedisTemplate redisTemplate SpringUtil.getBean(StringRedisTemplate.class);结果如下图 除了在IDEA中通过调用 redisCache.getCacheObject(“hhh”);方法来获取之外还可以打开解压文件中的redis-cli.exe输入 get hhh 来获 取值。
http://www.dnsts.com.cn/news/180943.html

相关文章:

  • 制作查询网站怎样进网站空间
  • 北京 网站设计飞沐网络工程师工作好找吗
  • 贵州建设项目门户网站台州网站建设企业
  • 网站备案代码生成工程公司招聘
  • 西地那非的危害公司网站如何优化
  • 建立网站 英语怎么说阿里云虚拟主机做2个网站
  • 标准网站有哪些浙江联科网站开发
  • 福州专业网站制作的公司html字体代码大全
  • 购物网站前端浮动特效怎么做免费网络电视直播
  • 上海模板建站软件广西壮族自治区招生考试院
  • 越秀网站建设公司app下载汅api免费下载大全视频
  • 中国建设官网招聘网站WordPress支付宝登录
  • 长春网站建设哪家公司好高端外贸建站
  • 可以做任务看漫画的漫画网站网站优化推广seo公司
  • 网站维护界面做网站找哪家好
  • 炫彩发光字制作网站wordpress ck
  • 哪些大型门户网站是用phpwind 搭建的淘宝网网站设计分析
  • 南宁网站建设公司比优建站贵阳网站建设托管
  • 如何做优酷网站点击赚钱湖南seo网站策划
  • 网站升级页面连接设置仁怀哪里可以做网站
  • 网站内容更新教程wordpress 批量删除评论
  • 学校网站logo怎么做重庆知名设计公司有哪些
  • 门户网站如何做谷歌seo郑州网站建设首选创新
  • 兰州忠旗网站建设科技有限公司网站转发
  • 手机模板网站模板下载网站有哪些荣耀手机官方旗舰店
  • 专门卖电子产品的网站做一视频网站
  • 江苏省住房和建设厅网站首页手机个人网页制作
  • 网站建设可自学吗济宁住房和城乡建设局网站
  • 为什么上不了建设银行个人网站wordpress插件怎么打开
  • 凡客家具质量怎么样优化系统