在mars.yml文件里添加如下配置

#redis配置
redis:
  # 这些都有默认值,可以不配
  maxTotal: 10
  maxIdle: 20
  minIdle: 2
  numTestsPerEvictionRun: 10000
  timeBetweenEvictionRunsMillis: 10000
  minEvictableIdleTimeMillis: 10000
  softMinEvictableIdleTimeMillis: 10000
  maxWaitMillis: 1000
  testOnBorrow: true
  testWhileIdle: true
  testOnReturn: true
  jmxEnabled: false
  jmxNamePrefix: pool
  blockWhenExhausted: false

  # 这个必须配置
  jedisShardInfos:
    -
      name: master
      host: 10.211.55.5
      port: 6379
      password: 123456

用RedisTemplete进行redis操作

RedisTemplete.set(key,value);
RedisTemplete.get(key,value);

Jedis里的其他方法都支持

results matching ""

    No results matching ""