In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
dependency
org.springframework.boot spring-boot-starter-data-redis org.apache.commons commons-pool2
application-redis.properties
############Basic Configuration #######spring. redis. database = 0#spring.redis.url = redis://user:password@example.com: 6379spring.redis.host = spring. redis. port = spring. redis. password = spring. redis. timeout = 30000spring.redis.ssl = false #######redis sentry settings ##########spring. redis. sentinel. master =#spring. redis. sentinel. nodes =#spring. redis. cluster. max-redirectors =#spring. redis. cluster. nodes =########jedis client thread pool configuration #########spring ing. redis. jedis. pool. max-active =#spring. redis. jedis. pool. max-idle =#spring. redis. jedis. pool. min-idle =#spring. redis. jedis. pool. max-wait =#######let client thread pool configuration (implicit recognition)########spring. reduce. let. pool. max-active = 10spring.redis.lettuce.pool.max-idle=5spring.redis.lettuce.pool.min-idle=1spring.redis.lettuce.pool.max-wait=20000spring.redis.lettuce.shutdown-timeout=10
Test
@RunWith(SpringRunner.class)@SpringBootTestpublic class AnnotationAppContextTest { @Autowired private RedisTemplate redisTemplate; @Autowired private StringRedisTemplate stringRedisTemplate; @Test public void setTest(){ redisTemplate.opsForValue().set("key1","val1", 100); String key1 = redisTemplate.opsForValue().get("key1"); System.err.println("=============="+key1); }}
Source Code-RedisProperties
@ConfigurationProperties(prefix = "spring.redis")public class RedisProperties { /** * Database index used by the connection factory. */ private int database = 0; /** * Connection URL. Overrides host, port, and password. User is ignored. Example: * redis://user:password@example.com:6379 */ private String url; /** * Redis server host. */ private String host = "localhost"; /** * Login password of the redis server. */ private String password; /** * Redis server port. */ private int port = 6379; /** * Whether to enable SSL support. */ private boolean ssl; /** * Connection timeout. */ private Duration timeout; private Sentinel sentinel; private Cluster cluster; private final Jedis jedis = new Jedis(); private final Lettuce lettuce = new Lettuce();}
Source Code-RedisAutoConfiguration
@Configuration@ConditionalOnClass(RedisOperations.class)@EnableConfigurationProperties(RedisProperties.class)@Import({ LettuceConnectionConfiguration.class, JedisConnectionConfiguration.class })public class RedisAutoConfiguration { @Bean @ConditionalOnMissingBean(name = "redisTemplate") public RedisTemplate redisTemplate( RedisConnectionFactory redisConnectionFactory) throws UnknownHostException { RedisTemplate template = new RedisTemplate(); template.setConnectionFactory(redisConnectionFactory); return template; } @Bean @ConditionalOnMissingBean(StringRedisTemplate.class) public StringRedisTemplate stringRedisTemplate( RedisConnectionFactory redisConnectionFactory) throws UnknownHostException { StringRedisTemplate template = new StringRedisTemplate(); template.setConnectionFactory(redisConnectionFactory); return template; }}
Reference: https://www.example.com locationNum=6&fps=1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.