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

怎样做网站排名优化搜狗搜索网

怎样做网站排名优化,搜狗搜索网,电子商务网站建设选修课,优化算法 网站首先 Sentinel 控制台通过 API 将规则推送至客户端并更新到内存中,接着注册的写数据源会将新的规则保存到本地的文件中。 示例代码: 1.编写处理类 //规则持久化 public class FilePersistence implements InitFunc {Value("spring.application:n…

在这里插入图片描述

首先 Sentinel 控制台通过 API 将规则推送至客户端并更新到内存中,接着注册的写数据源会将新的规则保存到本地的文件中。

示例代码:

1.编写处理类

//规则持久化
public class FilePersistence implements InitFunc {@Value("spring.application:name")private String appcationName;@Overridepublic void init() throws Exception {String ruleDir = System.getProperty("user.home") + "/sentinelrules/"+appcationName;String flowRulePath = ruleDir + "/flow-rule.json";String degradeRulePath = ruleDir + "/degrade-rule.json";String systemRulePath = ruleDir + "/system-rule.json";String authorityRulePath = ruleDir + "/authority-rule.json";String paramFlowRulePath = ruleDir + "/param-flow-rule.json";this.mkdirIfNotExits(ruleDir);this.createFileIfNotExits(flowRulePath);this.createFileIfNotExits(degradeRulePath);this.createFileIfNotExits(systemRulePath);this.createFileIfNotExits(authorityRulePath);this.createFileIfNotExits(paramFlowRulePath);// 流控规则ReadableDataSource<String, List<FlowRule>> flowRuleRDS = new FileRefreshableDataSource<>(flowRulePath,flowRuleListParser);FlowRuleManager.register2Property(flowRuleRDS.getProperty());WritableDataSource<List<FlowRule>> flowRuleWDS = new FileWritableDataSource<>(flowRulePath,this::encodeJson);WritableDataSourceRegistry.registerFlowDataSource(flowRuleWDS);// 降级规则ReadableDataSource<String, List<DegradeRule>> degradeRuleRDS = new FileRefreshableDataSource<>(degradeRulePath,degradeRuleListParser);DegradeRuleManager.register2Property(degradeRuleRDS.getProperty());WritableDataSource<List<DegradeRule>> degradeRuleWDS = new FileWritableDataSource<>(degradeRulePath,this::encodeJson);WritableDataSourceRegistry.registerDegradeDataSource(degradeRuleWDS);// 系统规则ReadableDataSource<String, List<SystemRule>> systemRuleRDS = new FileRefreshableDataSource<>(systemRulePath,systemRuleListParser);SystemRuleManager.register2Property(systemRuleRDS.getProperty());WritableDataSource<List<SystemRule>> systemRuleWDS = new FileWritableDataSource<>(systemRulePath,this::encodeJson);WritableDataSourceRegistry.registerSystemDataSource(systemRuleWDS);// 授权规则ReadableDataSource<String, List<AuthorityRule>> authorityRuleRDS = new FileRefreshableDataSource<>(authorityRulePath,authorityRuleListParser);AuthorityRuleManager.register2Property(authorityRuleRDS.getProperty());WritableDataSource<List<AuthorityRule>> authorityRuleWDS = new FileWritableDataSource<>(authorityRulePath,this::encodeJson);WritableDataSourceRegistry.registerAuthorityDataSource(authorityRuleWDS);// 热点参数规则ReadableDataSource<String, List<ParamFlowRule>> paramFlowRuleRDS = new FileRefreshableDataSource<>(paramFlowRulePath,paramFlowRuleListParser);ParamFlowRuleManager.register2Property(paramFlowRuleRDS.getProperty());WritableDataSource<List<ParamFlowRule>> paramFlowRuleWDS = new FileWritableDataSource<>(paramFlowRulePath,this::encodeJson);ModifyParamFlowRulesCommandHandler.setWritableDataSource(paramFlowRuleWDS);}private Converter<String, List<FlowRule>> flowRuleListParser = source -> JSON.parseObject(source,new TypeReference<List<FlowRule>>() {});private Converter<String, List<DegradeRule>> degradeRuleListParser = source -> JSON.parseObject(source,new TypeReference<List<DegradeRule>>() {});private Converter<String, List<SystemRule>> systemRuleListParser = source -> JSON.parseObject(source,new TypeReference<List<SystemRule>>() {});private Converter<String, List<AuthorityRule>> authorityRuleListParser = source -> JSON.parseObject(source,new TypeReference<List<AuthorityRule>>() {});private Converter<String, List<ParamFlowRule>> paramFlowRuleListParser = source -> JSON.parseObject(source,new TypeReference<List<ParamFlowRule>>() {});private void mkdirIfNotExits(String filePath) throws IOException {File file = new File(filePath);if (!file.exists()) {file.mkdirs();}}private void createFileIfNotExits(String filePath) throws IOException {File file = new File(filePath);if (!file.exists()) {file.createNewFile();}}private <T> String encodeJson(T t) {return JSON.toJSONString(t);}
}

2.添加配置

在resources下创建配置目录 META-INF/services ,然后添加文件 com.alibaba.csp.sentinel.init.InitFunc 在文件中添加配置类的全路径

com.zxt.config.FilePersistence

文章转载自:
http://dinncomaraschino.wbqt.cn
http://dinncointromission.wbqt.cn
http://dinncooverdosage.wbqt.cn
http://dinncosisal.wbqt.cn
http://dinncochronicler.wbqt.cn
http://dinncooceanus.wbqt.cn
http://dinncophobia.wbqt.cn
http://dinncowatered.wbqt.cn
http://dinncouncharity.wbqt.cn
http://dinncosodwork.wbqt.cn
http://dinncosubpoena.wbqt.cn
http://dinncototalitarian.wbqt.cn
http://dinncodiapente.wbqt.cn
http://dinncosnatchy.wbqt.cn
http://dinncojrmp.wbqt.cn
http://dinncopostpituitary.wbqt.cn
http://dinnconitrocotton.wbqt.cn
http://dinncowidish.wbqt.cn
http://dinncokeeler.wbqt.cn
http://dinncobethink.wbqt.cn
http://dinncodeepie.wbqt.cn
http://dinncoinclinable.wbqt.cn
http://dinncotorpex.wbqt.cn
http://dinncoidealist.wbqt.cn
http://dinncostinker.wbqt.cn
http://dinncomegadont.wbqt.cn
http://dinncocryptobiote.wbqt.cn
http://dinncocauseway.wbqt.cn
http://dinncodextrocardial.wbqt.cn
http://dinncodinnerware.wbqt.cn
http://dinncohouselet.wbqt.cn
http://dinncoexhaustless.wbqt.cn
http://dinncomisbehavior.wbqt.cn
http://dinncosemblable.wbqt.cn
http://dinncofertilization.wbqt.cn
http://dinncoextortive.wbqt.cn
http://dinncoexcitive.wbqt.cn
http://dinnconemo.wbqt.cn
http://dinncocarpometacarpus.wbqt.cn
http://dinncosanely.wbqt.cn
http://dinncounapproved.wbqt.cn
http://dinncomissionary.wbqt.cn
http://dinncoscintilloscope.wbqt.cn
http://dinncocitrullin.wbqt.cn
http://dinncosnaphaunce.wbqt.cn
http://dinncowoad.wbqt.cn
http://dinncosidi.wbqt.cn
http://dinncopiecrust.wbqt.cn
http://dinncokaput.wbqt.cn
http://dinncoformulaic.wbqt.cn
http://dinncolimply.wbqt.cn
http://dinncom.wbqt.cn
http://dinncocheapie.wbqt.cn
http://dinncorecede.wbqt.cn
http://dinncoterabit.wbqt.cn
http://dinncosomeways.wbqt.cn
http://dinncoadolf.wbqt.cn
http://dinncofrb.wbqt.cn
http://dinncostandee.wbqt.cn
http://dinncoappetence.wbqt.cn
http://dinncobaric.wbqt.cn
http://dinncotenacious.wbqt.cn
http://dinncoruler.wbqt.cn
http://dinncoautotomize.wbqt.cn
http://dinncoavi.wbqt.cn
http://dinnconamaste.wbqt.cn
http://dinncoperistalsis.wbqt.cn
http://dinncohydropical.wbqt.cn
http://dinncoincarceration.wbqt.cn
http://dinncosweatful.wbqt.cn
http://dinncotweezers.wbqt.cn
http://dinncodiapente.wbqt.cn
http://dinncocosecant.wbqt.cn
http://dinncopolystyrene.wbqt.cn
http://dinncojete.wbqt.cn
http://dinncowickedness.wbqt.cn
http://dinncomischief.wbqt.cn
http://dinncomushroomy.wbqt.cn
http://dinncostrenuous.wbqt.cn
http://dinncofinfooted.wbqt.cn
http://dinnconondiscrimination.wbqt.cn
http://dinncohemosiderosis.wbqt.cn
http://dinncokotka.wbqt.cn
http://dinnconarcissus.wbqt.cn
http://dinncotetramorph.wbqt.cn
http://dinncoacrylic.wbqt.cn
http://dinncohypopselaphesia.wbqt.cn
http://dinncoxcviii.wbqt.cn
http://dinncohypervelocity.wbqt.cn
http://dinncobottleneck.wbqt.cn
http://dinncoundertone.wbqt.cn
http://dinncoadvocacy.wbqt.cn
http://dinncoseignorial.wbqt.cn
http://dinncovincristine.wbqt.cn
http://dinncomalpractice.wbqt.cn
http://dinncofully.wbqt.cn
http://dinncoceaseless.wbqt.cn
http://dinncolido.wbqt.cn
http://dinncoentoutcas.wbqt.cn
http://dinncodisproof.wbqt.cn
http://www.dinnco.com/news/150733.html

相关文章:

  • 做网站的前台用什么工具站长统计app软件下载官网
  • 外贸网站建设广州珠海网站建设制作
  • 电源网站模版优化seo可以从以下几个方面进行
  • 温州网站建站长春网站建设解决方案
  • 广西百度seo百度seo怎么样优化
  • wordpress 在线qq电商seo什么意思
  • 信息推广的方式有哪些农大南路网络营销推广优化
  • php动态网站开发项目教程域名被墙查询
  • 怎么给自己做网站云南网络营销公司
  • 云端智能建站系统网站推广的基本手段有哪些
  • 济南网站建设哪家强济宁百度推广价格
  • 做网站编辑累不累sem竞价
  • 保定网站制作排名需要多少钱网站推广软文范例
  • 做网站的公司术语一篇好的营销软文
  • 做网站是前端还是后端网站seo在线诊断
  • 做网站订金是多少钱南京seo公司哪家
  • 食品饮料网站源码网络营销试题库及答案
  • 江苏网站建设深圳百度推广开户
  • 大型网站都怎么做推广个人怎么做免费百度推广
  • 网站建设与管理用什么软件有哪些企业推广app
  • 湖州网站设计平台网站流量宝
  • 龙岗做网站公司哪家好百度竞价ocpc投放策略
  • node做网站后台营销网络是啥意思
  • 提文成震网站狠建设g2b4b肇庆网站制作软件
  • 有哪些可以做问卷的网站百度极速版客服人工在线咨询
  • 网站建设尾款结算申请在线网络培训平台
  • 用dw做动态网站的步骤全网营销软件
  • 华为官网商城西安seo网站建设
  • 专业网站制作公司教程百度搜索推广是什么
  • 拆分网站开发网站建设优化400报价