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

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

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

Jedis.configSet介绍

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

The list of configuration parameters supported by CONFIG SET can be obtained issuing a #configGet(String) command.

The configuration set using CONFIG SET is immediately loaded by the Redis server that will start acting as specified starting from the next command.

Parameters value format

The value of the configuration parameter is the same as the one of the same parameter in the Redis configuration file, with the following exceptions:

  • The save parameter is a list of space-separated integers. Every pair of integers specify the time and number of changes limit to trigger a save. For instance the command CONFIG SET save "3600 10 60 10000" will configure the server to issue a background saving of the RDB file every 3600 seconds if there are at least 10 changes in the dataset, and every 60 seconds if there are at least 10000 changes. To completely disable automatic snapshots just set the parameter as an empty string.
  • All the integer parameters representing memory are returned and accepted only using bytes as unit.
    [中]更改正在运行的Redis服务器的配置。并非所有配置参数都受支持。
    通过发出#configGet(String)命令,可以获得CONFIG SET支持的配置参数列表。
    使用CONFIG set的配置集立即由Redis服务器加载,该服务器将从下一个命令开始按指定的方式运行。
    参数值格式
    配置参数的值与Redis配置文件中相同参数的值相同,但以下情况除外:
    *save参数是以空格分隔的整数列表。每对整数指定触发保存的时间和更改次数限制。例如,如果数据集中至少有10个更改,则命令CONFIG SET save“3600 10 60 10000”将配置服务器每3600秒发布一次RDB文件的后台保存,如果至少有10000个更改,则每60秒发布一次RDB文件的后台保存。要完全禁用自动快照,只需将参数设置为空字符串。
    *所有表示内存的整数参数仅以字节为单位返回和接受。

代码示例

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

@Override
public void setConfig(RedisClusterNode node, String param, String value) {
  Assert.notNull(param, "Parameter must not be null!");
  Assert.notNull(value, "Value must not be null!");
  executeCommandOnSingleNode(client -> client.configSet(param, value), node);
}

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

@Override
public void setConfig(String param, String value) {
  Assert.notNull(param, "Parameter must not be null!");
  Assert.notNull(value, "Value must not be null!");
  connection.getClusterCommandExecutor()
      .executeCommandOnAllNodes((JedisClusterCommandCallback<String>) client -> client.configSet(param, value));
}

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

@Override
public void setConfig(String param, String value) {
  Assert.notNull(param, "Parameter must not be null!");
  Assert.notNull(value, "Value must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newStatusResult(connection.getRequiredPipeline().configSet(param, value)));
      return;
    }
    if (isQueueing()) {
      transaction(connection.newStatusResult(connection.getRequiredTransaction().configSet(param, value)));
      return;
    }
    connection.getJedis().configSet(param, value);
  } 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: Impetus/Kundera

/**
 * Gets the and set connection.
 * 
 * @return the and set connection
 */
private Jedis getAndSetConnection()
{
  Jedis conn = factory.getConnection();
  this.connection = conn;
  // If resource is not null means a transaction in progress.
  if (settings != null)
  {
    for (String key : settings.keySet())
    {
      conn.configSet(key, settings.get(key).toString());
    }
  }
  return conn;
}

代码示例来源:origin: Impetus/Kundera

connection.configSet(key.toString(), props.get(key).toString());

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

@Override
public String configSet(String parameter, String value) {
  return jedis.configSet(parameter, value);
}

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

private String configset0(Jedis j, String parameter, String value) {
  return j.configSet(parameter, value);
}

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

public String configSet(String parameter, String value) {
  return master.configSet(parameter, value);
}

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

@Override
public String configSet(String parameter, String value) {
  return jedis.configSet(parameter, value);
}

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

public byte[] configSet(byte[] parameter, byte[] value) {
  return master.configSet(parameter, value);
}

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

@Override
public void setConfig(RedisClusterNode node, String param, String value) {
  Assert.notNull(param, "Parameter must not be null!");
  Assert.notNull(value, "Value must not be null!");
  executeCommandOnSingleNode(client -> client.configSet(param, value), node);
}

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

@Override
public String configSet(String parameter, String value) {
 String command = "configSet";
 return instrumented(command, () -> delegated.configSet(parameter, value));
}

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

@Override
public byte[] configSet(byte[] parameter, byte[] value) {
 String command = "configSet";
 return instrumented(command, () -> delegated.configSet(parameter, value));
}

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

@Override
public void setConfig(RedisClusterNode node, String param, String value) {
  Assert.notNull(param, "Parameter must not be null!");
  Assert.notNull(value, "Value must not be null!");
  executeCommandOnSingleNode(client -> client.configSet(param, value), node);
}

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

default String configset(String parameter, String value) {
 return this.run((jedis, serializer) -> jedis.configSet(parameter, value));
}

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

@Override
public void setConfig(String param, String value) {
  Assert.notNull(param, "Parameter must not be null!");
  Assert.notNull(value, "Value must not be null!");
  connection.getClusterCommandExecutor()
      .executeCommandOnAllNodes((JedisClusterCommandCallback<String>) client -> client.configSet(param, value));
}

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

@Override
public void setConfig(String param, String value) {
  Assert.notNull(param, "Parameter must not be null!");
  Assert.notNull(value, "Value must not be null!");
  connection.getClusterCommandExecutor()
      .executeCommandOnAllNodes((JedisClusterCommandCallback<String>) client -> client.configSet(param, value));
}

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

@Override
public void setConfig(String param, String value) {
  Assert.notNull(param, "Parameter must not be null!");
  Assert.notNull(value, "Value must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newStatusResult(connection.getRequiredPipeline().configSet(param, value)));
      return;
    }
    if (isQueueing()) {
      transaction(connection.newStatusResult(connection.getRequiredTransaction().configSet(param, value)));
      return;
    }
    connection.getJedis().configSet(param, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
public void setConfig(String param, String value) {
  Assert.notNull(param, "Parameter must not be null!");
  Assert.notNull(value, "Value must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newStatusResult(connection.getRequiredPipeline().configSet(param, value)));
      return;
    }
    if (isQueueing()) {
      transaction(connection.newStatusResult(connection.getRequiredTransaction().configSet(param, value)));
      return;
    }
    connection.getJedis().configSet(param, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

相关文章

微信公众号

最新文章

更多

Jedis类方法