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

如何开自己的网站沈阳注册公司

如何开自己的网站,沈阳注册公司,微商怎么推广自己的产品,澄海建网站2019独角兽企业重金招聘Python工程师标准 spring集成 JedisCluster 连接 redis3.0 集群 博客分类#xff1a; 缓存 spring 客户端采用最新的jedis 2.7 1. maven依赖#xff1a; dependency groupIdredis.clients/groupId artifact… 2019独角兽企业重金招聘Python工程师标准 spring集成 JedisCluster 连接 redis3.0 集群 博客分类 缓存 spring 客户端采用最新的jedis 2.7 1. maven依赖 dependency groupIdredis.clients/groupId artifactIdjedis/artifactId version2.7.2/version /dependency   2. 增加spring 配置 Java代码   bean namegenericObjectPoolConfig classorg.apache.commons.pool2.impl.GenericObjectPoolConfig           property namemaxWaitMillis value-1 /          property namemaxTotal value1000 /          property nameminIdle value8 /          property namemaxIdle value100 /  /bean    bean idjedisCluster classxxx.JedisClusterFactory      property nameaddressConfig          valueclasspath:connect-redis.properties/value      /property      property nameaddressKeyPrefix valueaddress /   !--  属性文件里  key的前缀 --            property nametimeout value300000 /      property namemaxRedirections value6 /      property namegenericObjectPoolConfig refgenericObjectPoolConfig /  /bean     3. 增加connect-redis.properties  配置文件 这里配置了6个节点 Java代码   address1172.16.23.27:6379  address2172.16.23.27:6380  address3172.16.23.27:6381  address4172.16.23.27:6382  address5172.16.23.27:6383  address6172.16.23.27:6384     4. 增加java类 Java代码   import java.util.HashSet;  import java.util.Properties;  import java.util.Set;  import java.util.regex.Pattern;    import org.apache.commons.pool2.impl.GenericObjectPoolConfig;  import org.springframework.beans.factory.FactoryBean;  import org.springframework.beans.factory.InitializingBean;  import org.springframework.core.io.Resource;    import redis.clients.jedis.HostAndPort;  import redis.clients.jedis.JedisCluster;    public class JedisClusterFactory implements FactoryBeanJedisCluster, InitializingBean {        private Resource addressConfig;      private String addressKeyPrefix ;        private JedisCluster jedisCluster;      private Integer timeout;      private Integer maxRedirections;      private GenericObjectPoolConfig genericObjectPoolConfig;            private Pattern p  Pattern.compile(^.[:]\\d{1,5}\\s*$);        Override       public JedisCluster getObject() throws Exception {          return jedisCluster;      }        Override       public Class? extends JedisCluster getObjectType() {          return (this.jedisCluster ! null ? this.jedisCluster.getClass() : JedisCluster.class);      }        Override       public boolean isSingleton() {          return true;      }            private SetHostAndPort parseHostAndPort() throws Exception {          try {              Properties prop  new Properties();              prop.load(this.addressConfig.getInputStream());                SetHostAndPort haps  new HashSetHostAndPort();              for (Object key : prop.keySet()) {                    if (!((String) key).startsWith(addressKeyPrefix)) {                      continue;                  }                    String val  (String) prop.get(key);                    boolean isIpPort  p.matcher(val).matches();                    if (!isIpPort) {                      throw new IllegalArgumentException(ip 或 port 不合法);                  }                  String[] ipAndPort  val.split(:);                    HostAndPort hap  new HostAndPort(ipAndPort[0], Integer.parseInt(ipAndPort[1]));                  haps.add(hap);              }                return haps;          } catch (IllegalArgumentException ex) {              throw ex;          } catch (Exception ex) {              throw new Exception(解析 jedis 配置文件失败, ex);          }      }            Override       public void afterPropertiesSet() throws Exception {          SetHostAndPort haps  this.parseHostAndPort();                    jedisCluster  new JedisCluster(haps, timeout, maxRedirections,genericObjectPoolConfig);                }      public void setAddressConfig(Resource addressConfig) {          this.addressConfig  addressConfig;      }        public void setTimeout(int timeout) {          this.timeout  timeout;      }        public void setMaxRedirections(int maxRedirections) {          this.maxRedirections  maxRedirections;      }        public void setAddressKeyPrefix(String addressKeyPrefix) {          this.addressKeyPrefix  addressKeyPrefix;      }        public void setGenericObjectPoolConfig(GenericObjectPoolConfig genericObjectPoolConfig) {          this.genericObjectPoolConfig  genericObjectPoolConfig;      }    }       5. 到此配置完成 使用时直接注入即可 如下所示   Autowired JedisCluster jedisCluster;   http://xyqck163.iteye.com/blog/2211108 转载于:https://my.oschina.net/xiaominmin/blog/1599371
http://www.sadfv.cn/news/318631/

相关文章:

  • 贷款网站源码下载公司网站建设费用多少
  • 内销网站怎么做深圳vi设计平台
  • 网站设计制作太原建筑公司注册要求
  • 松江九亭网站建设网站建设捌金手指专业5
  • 怎么做黑彩黑彩网站精品课程网站建设开题报告
  • 尤溪网站建设wordpress同步头条
  • 网站建设新一点网络成都网站app开发
  • 网站建设的地方wordpress配置多语言包
  • 免费申请网站com域名wordpress 分页太慢
  • 企业网站建设营销免费开通的网站
  • 太原网站制作费用百度怎么优化关键词排名
  • 公益网站建设方案葡京网站做中间商
  • 手机网站微信网站开发网站服务器崩溃
  • 网站的推广费用建设网站用什么技术
  • 大连做优化网站哪家好网站标题用什么符号
  • 建设网上银行网站晾衣架 东莞网站建设
  • 婚纱网站制作传奇游戏排行榜
  • 网站标题优化技巧临沂百度公司地址
  • 利用店铺网站做灰色优化平面素材网站哪个最好
  • 用淘宝域名做网站什么效果上海建设工程造价网站
  • 做网站公司q房网定制高端网站建设
  • 手机百度网站建设将网站发布到微信小程序怎么做
  • 有关网站建设的公众号网站推广员
  • 深圳网站建设找哪家深圳公明做网站
  • 涡阳网站建设哪家好常用小网站
  • 空调公司网站建设钟祥网站建设
  • 自己注册一个网站要多少钱微商营销宝app下载
  • 网站建设高职考题目网站建设步骤和流程
  • 哪里有网站开发设计室内设计平面图讲解
  • 网站建设自适应网站网站的设计方法有哪些内容