// 获取redis内存信息
Properties info = redisTemplate.getRequiredConnectionFactory().getConnection().info("memory");
//三个主要类
RedisConnectionFactory
RedisConnection
RedisTemplate
//三个主要类 的关联
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);
template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(new RedisValueSerializer());
return template;
}