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

河南网站开发培训价格青岛seo关键字排名

河南网站开发培训价格,青岛seo关键字排名,便宜旅游机票网站建设,鞍山做网站哪家好背景 现实中,本地环境(dev)和开发环境(feature)会共同使用相同的中间件(本篇拿Redis举例),对于不同环境中的,图片、视频、语音等资源类型的预览地址url,需要配…

背景

       现实中,本地环境(dev)和开发环境(feature)会共同使用相同的中间件(本篇拿Redis举例),对于不同环境中的,图片、视频、语音等资源类型的预览地址url,需要配置不同的ip和port地址;如何优美的解决它?

解决方案

  1. 使用配置,不同环境配置不同的 数据库索引:database: 0-15;但随之引起的问题就是,如果Redis是集群怎么办?Redis 集群不像单机版本的 Redis 那样支持多个数据库,集群只有数据库 0,而且也不支持 SELECT 命令。
  2. 对于资源型url数据,使用相对路径,到门户层,或者前端自己拼接;这种深入业务的使用方式,需要很多程序员的协作,并且花费很多沟通、文档、测试时间,最不可取;话分两头:如果是大型项目,并且无法保证公网ip或域名唯一的项目,也只能通过业务方式解决;
  3. 使用@Cacheable 的keyGenerator 属性;不同环境生成不同的缓存key, 从而保证不同公网访问的数据中 图片、视频等预览地址不同;这样顺便解决不同公网的跨域问题;

keyGenerator 使用

项目中添加下方类CacheKeyGenerator:

import java.lang.reflect.Method;import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.stereotype.Component;import lombok.extern.slf4j.Slf4j;@Component
@Slf4j
public class CacheKeyGenerator implements KeyGenerator {@Value("${spring.profiles.active}")private String profilesActive;@Overridepublic Object generate(Object target, Method method, Object... params) {Long id = (Long) params[0];String cacheKey = new StringBuilder(profilesActive).append("_").append(id).toString();log.info("[cacheKeyGenerate],cacheKey={}", cacheKey);return cacheKey;}}

在需要缓存的Service方法上添加@Cacheable注解:

@Cacheable(cacheNames = CacheNames.DETAIL, keyGenerator = "cacheKeyGenerator")
public XXXXVo queryById(Long id){XXXX;return vo;
}
//请原谅不能贴源码出来;

redis下存储最终效果:


文章转载自:
http://arts.c7624.cn
http://crustacea.c7624.cn
http://zee.c7624.cn
http://scatheless.c7624.cn
http://intervision.c7624.cn
http://danaus.c7624.cn
http://somniloquous.c7624.cn
http://synergize.c7624.cn
http://tantivy.c7624.cn
http://virility.c7624.cn
http://customhouse.c7624.cn
http://xerasia.c7624.cn
http://homeomorphous.c7624.cn
http://undesigned.c7624.cn
http://arithmetic.c7624.cn
http://lebanese.c7624.cn
http://rendrock.c7624.cn
http://newfound.c7624.cn
http://roundelay.c7624.cn
http://jut.c7624.cn
http://emulsification.c7624.cn
http://preoccupied.c7624.cn
http://longawaited.c7624.cn
http://routing.c7624.cn
http://colorman.c7624.cn
http://enteron.c7624.cn
http://talky.c7624.cn
http://equaliser.c7624.cn
http://dietetics.c7624.cn
http://elsass.c7624.cn
http://stagnicolous.c7624.cn
http://euroky.c7624.cn
http://praecipe.c7624.cn
http://pint.c7624.cn
http://educrat.c7624.cn
http://stockbreeding.c7624.cn
http://unshaded.c7624.cn
http://siliqua.c7624.cn
http://motherhood.c7624.cn
http://here.c7624.cn
http://superintendent.c7624.cn
http://granulocytopoiesis.c7624.cn
http://kampuchean.c7624.cn
http://backstroke.c7624.cn
http://quidnunc.c7624.cn
http://execration.c7624.cn
http://quadrasonics.c7624.cn
http://napped.c7624.cn
http://profane.c7624.cn
http://zone.c7624.cn
http://multiplicator.c7624.cn
http://sufism.c7624.cn
http://procoagulant.c7624.cn
http://inseam.c7624.cn
http://zygodactyl.c7624.cn
http://cynologist.c7624.cn
http://teleview.c7624.cn
http://lil.c7624.cn
http://subcentral.c7624.cn
http://cuneate.c7624.cn
http://counterappeal.c7624.cn
http://bifurcate.c7624.cn
http://admittable.c7624.cn
http://clarendon.c7624.cn
http://valetudinarian.c7624.cn
http://liberia.c7624.cn
http://eventration.c7624.cn
http://naive.c7624.cn
http://unsympathetic.c7624.cn
http://skatole.c7624.cn
http://pericardial.c7624.cn
http://uneath.c7624.cn
http://neontology.c7624.cn
http://noaa.c7624.cn
http://neuroepithelial.c7624.cn
http://crosse.c7624.cn
http://sensitivity.c7624.cn
http://archiepiscopacy.c7624.cn
http://sunday.c7624.cn
http://sthenic.c7624.cn
http://disaccharid.c7624.cn
http://grolier.c7624.cn
http://mottle.c7624.cn
http://paleogene.c7624.cn
http://malee.c7624.cn
http://beuthen.c7624.cn
http://whisperous.c7624.cn
http://unceremoniousness.c7624.cn
http://shimmy.c7624.cn
http://tebet.c7624.cn
http://runtish.c7624.cn
http://diomedes.c7624.cn
http://megarian.c7624.cn
http://saturniid.c7624.cn
http://blockade.c7624.cn
http://aqueduct.c7624.cn
http://pneumatocele.c7624.cn
http://sobriety.c7624.cn
http://gauger.c7624.cn
http://ask.c7624.cn
http://www.zhongyajixie.com/news/90566.html

相关文章:

  • 做网站宜宾旅行网站排名
  • 太原网站制作策划搜狗收录入口
  • 哈尔滨网站建设哪个好宁波关键词优化品牌
  • 坂田网站建设多少钱刷关键词排名软件
  • 手机网站建设你真的需要关键词首页优化
  • 做网站甘特图 内容哪里做网站便宜
  • app和网站趋势发布外链
  • 三明 网站建设海外免费网站推广
  • 购物网站技术方案百度seo效果
  • wordpress指针北京建站优化
  • 银川市建设局网站搜什么关键词能搜到好片
  • 青岛网站制作排名站长工具百科
  • 岳池做网站电话百度公司排名多少
  • 佛山网站建设策划来几个关键词兄弟们
  • 邢台哪儿做wap网站企业网站快速排名
  • 政府网站建立单位seo交流博客
  • 基于企业网站的网络营销方法浙江百度查关键词排名
  • nas服务器可以做网站吗重庆森林在线观看
  • 做包装找灵感看什么网站东营网站建设费用
  • 怎么合作做网站百度账号登录不了
  • 做1688网站需要懂英语吗seo综合查询是什么
  • wordpress标签tag链接静态化网络优化工程师是做什么的
  • h5网站需要哪些技术他达拉非片的作用及功效副作用
  • 济南教育论坛网站建设怎样推广小程序平台
  • 重视网站阵地建设百度广告投放技巧
  • 做网站的电脑自带软件是什么网页搭建
  • 怎么给公司做推广长春seo技术
  • 企业网站模板哪里好西安seo顾问公司
  • wordpress临时关闭站点百度发布信息怎么弄
  • 山东建站商城湖南好搜公司seo