redis.clients.jedis.params.ShutdownParams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jedis Show documentation
Show all versions of jedis Show documentation
Jedis is a blazingly small and sane Redis java client.
package redis.clients.jedis.params;
import redis.clients.jedis.CommandArguments;
import redis.clients.jedis.Protocol;
import redis.clients.jedis.args.SaveMode;
import redis.clients.jedis.util.SafeEncoder;
public class ShutdownParams implements IParams {
private SaveMode saveMode;
private boolean now;
private boolean force;
public static ShutdownParams shutdownParams() {
return new ShutdownParams();
}
public ShutdownParams saveMode(SaveMode saveMode) {
this.saveMode = saveMode;
return this;
}
public ShutdownParams nosave() {
return this.saveMode(SaveMode.NOSAVE);
}
public ShutdownParams save() {
return this.saveMode(SaveMode.SAVE);
}
public ShutdownParams now() {
this.now = true;
return this;
}
public ShutdownParams force() {
this.force = true;
return this;
}
@Override
public void addParams(CommandArguments args) {
if (this.saveMode != null) {
args.add(SafeEncoder.encode(saveMode.getRaw()));
}
if (this.now) {
args.add(Protocol.Keyword.NOW.getRaw());
}
if (this.force) {
args.add(Protocol.Keyword.FORCE.getRaw());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy