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

建设银行第三方网站鉴权搜索引擎营销的手段包括

建设银行第三方网站鉴权,搜索引擎营销的手段包括,湖北 网站备案,培训机构整顿文章目录 缓存一致性Spring Cachepom.xmlapplication.ymlCubemallProductApplication.javaSpringCache改造三级分类MyCacheConfig.java缓存一致性 缓存一致性 锁 设置过期时间 读写锁 设置过期时间 Spring Cache 1.读模式 缓存穿透:查询一个null数据,…

文章目录

  • 缓存一致性
  • Spring Cache
    • pom.xml
    • application.yml
    • CubemallProductApplication.java
    • SpringCache改造三级分类
    • MyCacheConfig.java
    • 缓存一致性

缓存一致性

双写模式

设置过期时间
失效模式
读写锁
设置过期时间

Spring Cache

1.读模式
缓存穿透:查询一个null数据,解决:开启缓存空数据,spring.cache.redis.cache-null-values=true
缓存击穿:大量并发进来查询一个正好过期的数据,解决:加锁
缓存雪崩:大量的key同时过期 解决:加过期时间,spring.cache.redis.time-to-live=3600000
2.写模式:缓存与数据库一致
读写加锁。
引入Canal,感知到MySQL的更新去更新数据库
读多写多,直接去数据库查询就行

pom.xml

        <!-- https://mvnrepository.com/artifact/org.springframework.session/spring-session-data-redis --><dependency><groupId>org.springframework.session</groupId><artifactId>spring-session-data-redis</artifactId></dependency><!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-cache --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-cache</artifactId></dependency>

application.yml

spring:cache:type: redisredis:time-to-live: 3600000cache-null-values: true

CubemallProductApplication.java

package com.xd.cubemall.product;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;@EnableCaching
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = "com.xd.cubemall.product.feign")
public class CubemallProductApplication {public static void main(String[] args) {SpringApplication.run(CubemallProductApplication.class, args);}}

SpringCache改造三级分类

    /*** 使用SpringCache改造三级分类* @return*/@Cacheable(value={"category"}, key = "#root.method.name")public List<CategoryVo> getLevel1Categorys() {System.out.println("缓存不命中,查询数据库。。。");//2.缓存中没有数据,查询数据库,从数据库查询分类数据List<CategoryVo> categoryJsonFromDb = getCategoryJsonFromWithRedissonLock();return categoryJsonFromDb;}

MyCacheConfig.java

package com.xd.cubemall.product.config;import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.StringRedisSerializer;@Configuration
@EnableCaching
public class MyCacheConfig {@BeanRedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties){RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig();//修改key和value的序列号机制config = config.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer()));config = config.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer()));//将配置文件中的所有配置进行生效CacheProperties.Redis redisProperties = cacheProperties.getRedis();if (redisProperties.getTimeToLive() != null) {config = config.entryTtl(redisProperties.getTimeToLive());}if (redisProperties.getKeyPrefix() != null) {config = config.prefixKeysWith(redisProperties.getKeyPrefix());}if (!redisProperties.isCacheNullValues()) {config = config.disableCachingNullValues();}if (!redisProperties.isUseKeyPrefix()) {config = config.disableKeyPrefix();}return config;}
}

缓存一致性

    /*** 三级菜单的级联更新 (缓存一致性)* @param category*/@CacheEvict(value = "category", key = "'getLevel1Categorys'")@Overridepublic void updateCascade(CategoryEntity category) {this.updateById(category);}
http://www.dtcms.com/wzjs/136230.html

相关文章:

  • 现在的网站做多大尺寸的网址导航
  • 上海建设工程服务交易网优化公司
  • 青海 网站开发 app国外网站
  • 有那种网站么360优化大师官方最新
  • 网站的推广方式包括搜索引擎外部优化有哪些渠道
  • 无锡政府门户网站建设的调查报告网络推广公司怎么找客户
  • 网站阵地建设管理中山做网站推广公司
  • 网站开发asp.net苏州seo网站推广哪家好
  • 网站建设南昌爱站网影院
  • 微信网站用什么制作的广州最新消息
  • 自己做网站可以挣钱吗杭州seo薪资水平
  • 手机网站建设咨询百度竞价排名叫什么
  • 受欢迎的丹阳网站建设百度打广告怎么收费
  • 深圳营销型网站建设优化网络营销的流程和方法
  • wordpress 获取文章id南京seo网站优化推广
  • 美女做直播网站有哪些关键词数据分析工具有哪些
  • wordpress修改域名登录后台seo快速排名是什么
  • java 做网站今日热点新闻大事件
  • 被墙网站怎么做301跳转小视频网站哪个可以推广
  • 做公司网站需要哪些资料河北seo推广方案
  • 做生物卷子的网站seo搜索优化专员招聘
  • 临汾网站建设太仓网站制作
  • 做平台的网站有哪些功能郑州网站建设十大公司
  • 农家院做宣传应该在哪个网站沧州百度推广公司
  • 网站关键词优化的方法软文发布的平台与板块
  • 网站建设好公司杭州网站免费制作
  • 深圳网站建设公司排行营销手段和技巧
  • 可视网站开发工具竞价外包推广
  • googleseo关键词佛山旺道seo
  • 黑苹果做网站开发网站seo关键词优化排名