Example usage for org.springframework.data.redis.connection RedisConnection info

List of usage examples for org.springframework.data.redis.connection RedisConnection info

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection RedisConnection info.

Prototype

@Nullable
Properties info();

Source Link

Document

Load default server information like
  • memory
  • cpu utilization
  • replication

Usage

From source file:com.snowstore.mercury.indicator.RedisHealthIndicator.java

@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
    if (valid) {//  w w w  . j  a v  a  2s.c  om
        RedisConnection connection = RedisConnectionUtils.getConnection(this.redisConnectionFactory);
        try {
            Properties info = connection.info();
            builder.up().withDetail("version", info.getProperty("redis_version"));
            if (redisConnectionFactory instanceof JedisConnectionFactory) {
                JedisConnectionFactory jedisConnectionFactory = (JedisConnectionFactory) redisConnectionFactory;
                builder.withDetail(SERVER, jedisConnectionFactory.getHostName() + ":"
                        + jedisConnectionFactory.getPort() + ":" + jedisConnectionFactory.getDatabase());
            }
            addBuilder(builder);
        } finally {
            RedisConnectionUtils.releaseConnection(connection, this.redisConnectionFactory);
        }
    } else {
        builder.none();
    }
}

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Load {@literal default} server information like
 * <ul>/*  w w  w.  j av a 2 s  .c  o  m*/
 * <li>mempory</li>
 * <li>cpu utilization</li>
 * <li>replication</li>
 * </ul>
 * <p>
 * See http://redis.io/commands/info
 * 
 * @return Properties
 */
public static Properties info() {
    return redisTemplate.execute(new RedisCallback<Properties>() {
        @Override
        public Properties doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.info();
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Load {@literal default} server information like
 * <ul>//from   w w  w  . ja  va  2  s.  c om
 * <li>mempory</li>
 * <li>cpu utilization</li>
 * <li>replication</li>
 * </ul>
 * <p>
 * See http://redis.io/commands/info
 * 
 * @return Properties
 */
public Properties info() {
    return redisTemplate.execute(new RedisCallback<Properties>() {
        @Override
        public Properties doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.info();
        }
    });
}