redis.clients.jedis.Jedis.configGet()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(348)

本文整理了Java中redis.clients.jedis.Jedis.configGet()方法的一些代码示例,展示了Jedis.configGet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.configGet()方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:configGet

Jedis.configGet介绍

[英]Retrieve the configuration of a running Redis server. Not all the configuration parameters are supported.

CONFIG GET returns the current configuration parameters. This sub command only accepts a single argument, that is glob style pattern. All the configuration parameters matching this parameter are reported as a list of key-value pairs.

Example:

$ redis-cli config get '*' 
1. "dbfilename" 
2. "dump.rdb" 
3. "requirepass" 
4. (nil) 
5. "masterauth" 
6. (nil) 
7. "maxmemory" 
8. "0\n" 
9. "appendfsync" 
10. "everysec" 
11. "save" 
12. "3600 1 300 100 60 10000" 
$ redis-cli config get 'm*' 
1. "masterauth" 
2. (nil) 
3. "maxmemory" 
4. "0\n"

[中]检索正在运行的Redis服务器的配置。并非所有配置参数都受支持。
CONFIG GET返回当前配置参数。此子命令只接受一个参数,即全局样式模式。与此参数匹配的所有配置参数都报告为键值对列表。
例子:

$ redis-cli config get '*' 
1. "dbfilename" 
2. "dump.rdb" 
3. "requirepass" 
4. (nil) 
5. "masterauth" 
6. (nil) 
7. "maxmemory" 
8. "0\n" 
9. "appendfsync" 
10. "everysec" 
11. "save" 
12. "3600 1 300 100 60 10000" 
$ redis-cli config get 'm*' 
1. "masterauth" 
2. (nil) 
3. "maxmemory" 
4. "0\n"

代码示例

代码示例来源:origin: caoxinyu/RedisClient

@Override
public void command() {
  try{
    List<String> dbs = jedis.configGet("databases");
    if(dbs.size() > 0)
      dbAmount = Integer.parseInt(dbs.get(1));
  }catch(JedisException e){
    dbAmount = 15;
  }
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Properties getConfig(RedisClusterNode node, String pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  return connection.getClusterCommandExecutor()
      .executeCommandOnSingleNode(
          (JedisClusterCommandCallback<Properties>) client -> Converters.toProperties(client.configGet(pattern)),
          node)
      .getValue();
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Properties getConfig(String pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  List<NodeResult<List<String>>> mapResult = connection.getClusterCommandExecutor()
      .executeCommandOnAllNodes((JedisClusterCommandCallback<List<String>>) client -> client.configGet(pattern))
      .getResults();
  List<String> result = new ArrayList<>();
  for (NodeResult<List<String>> entry : mapResult) {
    String prefix = entry.getNode().asString();
    int i = 0;
    for (String value : entry.getValue()) {
      result.add((i++ % 2 == 0 ? (prefix + ".") : "") + value);
    }
  }
  return Converters.toProperties(result);
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Properties getConfig(String pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().configGet(pattern),
          Converters.listToPropertiesConverter()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().configGet(pattern),
          Converters.listToPropertiesConverter()));
      return null;
    }
    return Converters.toProperties(connection.getJedis().configGet(pattern));
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: uber/chaperone

private void setRedisConfig(String configName, String newValue) {
 List<String> config = jedis.configGet(configName);
 logger.info("Set redisConfig={} from oldValue={} to newValue={}", configName, config.get(1), newValue);
 String status = jedis.configSet(configName, newValue);
 Preconditions.checkState(status.equals("OK"), String.format("Set %s to %s for redis failed", configName, newValue));
}

代码示例来源:origin: io.leopard/leopard-redis

@Override
public List<String> configGet(String pattern) {
  return jedis.configGet(pattern);
}

代码示例来源:origin: io.leopard/leopard-redis

@Override
public List<String> configGet(String pattern) {
  return jedis.configGet(pattern);
}

代码示例来源:origin: penggle/jedis-ms-sentinel

public List<String> configGet(String pattern) {
  return master.configGet(pattern);
}

代码示例来源:origin: penggle/jedis-ms-sentinel

public List<byte[]> configGet(byte[] pattern) {
  return master.configGet(pattern);
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public List<String> configGet(String pattern) {
 String command = "configGet";
 return instrumented(command, () -> delegated.configGet(pattern));
}

代码示例来源:origin: mindwind/craft-atom

private Map<String, String> configget0(Jedis j, String parameter) {
  Map<String, String> map = new LinkedHashMap<String, String>();
  List<String> l = j.configGet(parameter);
  for (int i = 0; i < l.size(); i += 2) {
    String name = l.get(i);
    String value = null;
    if (i + 1 < l.size()) {
      value = l.get(i + 1);
      value = ("".equals(value) ? null : value);
    }
    map.put(name, value);
  }
  return map;
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public List<byte[]> configGet(byte[] pattern) {
 String command = "configGet";
 return instrumented(command, () -> delegated.configGet(pattern));
}

代码示例来源:origin: io.enoa/nosql-redis

default List<String> configget(String pattern) {
 return this.run((jedis, serializer) -> jedis.configGet(pattern));
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Properties getConfig(RedisClusterNode node, String pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  return connection.getClusterCommandExecutor().executeCommandOnSingleNode(
      (JedisClusterCommandCallback<Properties>) client -> Converters.toProperties(client.configGet(pattern)), node)
      .getValue();
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Properties getConfig(RedisClusterNode node, String pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  return connection.getClusterCommandExecutor().executeCommandOnSingleNode(
      (JedisClusterCommandCallback<Properties>) client -> Converters.toProperties(client.configGet(pattern)), node)
      .getValue();
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

Jedis jedis = getJedis();
try {
  return jedis.configGet(pattern);
} finally {Streams.safeClose(jedis);}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Properties getConfig(String pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  List<NodeResult<List<String>>> mapResult = connection.getClusterCommandExecutor()
      .executeCommandOnAllNodes((JedisClusterCommandCallback<List<String>>) client -> client.configGet(pattern))
      .getResults();
  List<String> result = new ArrayList<>();
  for (NodeResult<List<String>> entry : mapResult) {
    String prefix = entry.getNode().asString();
    int i = 0;
    for (String value : entry.getValue()) {
      result.add((i++ % 2 == 0 ? (prefix + ".") : "") + value);
    }
  }
  return Converters.toProperties(result);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Properties getConfig(String pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  List<NodeResult<List<String>>> mapResult = connection.getClusterCommandExecutor()
      .executeCommandOnAllNodes((JedisClusterCommandCallback<List<String>>) client -> client.configGet(pattern))
      .getResults();
  List<String> result = new ArrayList<>();
  for (NodeResult<List<String>> entry : mapResult) {
    String prefix = entry.getNode().asString();
    int i = 0;
    for (String value : entry.getValue()) {
      result.add((i++ % 2 == 0 ? (prefix + ".") : "") + value);
    }
  }
  return Converters.toProperties(result);
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Properties getConfig(String pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().configGet(pattern),
          Converters.listToPropertiesConverter()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().configGet(pattern),
          Converters.listToPropertiesConverter()));
      return null;
    }
    return Converters.toProperties(connection.getJedis().configGet(pattern));
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Properties getConfig(String pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().configGet(pattern),
          Converters.listToPropertiesConverter()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().configGet(pattern),
          Converters.listToPropertiesConverter()));
      return null;
    }
    return Converters.toProperties(connection.getJedis().configGet(pattern));
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

相关文章

微信公众号

最新文章

更多

Jedis类方法