Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions src/main/java/io/valkey/CommandObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import io.valkey.params.GeoRadiusStoreParam;
import io.valkey.params.GeoSearchParam;
import io.valkey.params.GetExParams;
import io.valkey.params.HGetExParams;
import io.valkey.params.HSetExParams;
import io.valkey.params.LCSParams;
import io.valkey.params.LPosParams;
import io.valkey.params.MigrateParams;
Expand Down Expand Up @@ -1242,6 +1244,171 @@ public final CommandObject<ScanResult<byte[]>> hscanNoValues(byte[] key, byte[]
public final CommandObject<Long> hstrlen(byte[] key, byte[] field) {
return new CommandObject<>(commandArguments(Command.HSTRLEN).key(key).add(field), BuilderFactory.LONG);
}

public final CommandObject<Long> hsetex(String key, HSetExParams params, String field, String value) {
return new CommandObject<>(commandArguments(Command.HSETEX).key(key)
.addParams(params).add(Keyword.FIELDS).add(1).add(field).add(value), BuilderFactory.LONG);
}

public final CommandObject<Long> hsetex(String key, HSetExParams params, Map<String, String> hash) {
return new CommandObject<>(addFlatMapArgs(commandArguments(Command.HSETEX).key(key)
.addParams(params).add(Keyword.FIELDS).add(hash.size()), hash), BuilderFactory.LONG);
}

public final CommandObject<List<String>> hgetex(String key, HGetExParams params, String... fields) {
return new CommandObject<>(commandArguments(Command.HGETEX).key(key)
.addParams(params).add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.STRING_LIST);
}

public final CommandObject<Long> hsetex(byte[] key, HSetExParams params, byte[] field, byte[] value) {
return new CommandObject<>(commandArguments(Command.HSETEX).key(key)
.addParams(params).add(Keyword.FIELDS).add(1).add(field).add(value), BuilderFactory.LONG);
}

public final CommandObject<Long> hsetex(byte[] key, HSetExParams params, Map<byte[], byte[]> hash) {
return new CommandObject<>(addFlatMapArgs(commandArguments(Command.HSETEX).key(key)
.addParams(params).add(Keyword.FIELDS).add(hash.size()), hash), BuilderFactory.LONG);
}

public final CommandObject<List<byte[]>> hgetex(byte[] key, HGetExParams params, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HGETEX).key(key)
.addParams(params).add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.BINARY_LIST);
}

public final CommandObject<List<byte[]>> hgetdel(byte[] key, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HGETDEL).key(key).add(Keyword.FIELDS)
.add(fields.length).addObjects((Object[]) fields), BuilderFactory.BINARY_LIST);
}

public final CommandObject<List<Long>> hexpire(String key, long seconds, String... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIRE).key(key).add(seconds)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hexpire(String key, long seconds, ExpiryOption condition, String... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIRE).key(key).add(seconds).add(condition)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpire(String key, long milliseconds, String... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIRE).key(key).add(milliseconds)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpire(String key, long milliseconds, ExpiryOption condition, String... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIRE).key(key).add(milliseconds).add(condition)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hexpireAt(String key, long unixTimeSeconds, String... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIREAT).key(key).add(unixTimeSeconds)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hexpireAt(String key, long unixTimeSeconds, ExpiryOption condition, String... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIREAT).key(key).add(unixTimeSeconds).add(condition)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpireAt(String key, long unixTimeMillis, String... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIREAT).key(key).add(unixTimeMillis)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpireAt(String key, long unixTimeMillis, ExpiryOption condition, String... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIREAT).key(key).add(unixTimeMillis).add(condition)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hexpire(byte[] key, long seconds, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIRE).key(key).add(seconds)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hexpire(byte[] key, long seconds, ExpiryOption condition, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIRE).key(key).add(seconds).add(condition)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpire(byte[] key, long milliseconds, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIRE).key(key).add(milliseconds)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpire(byte[] key, long milliseconds, ExpiryOption condition, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIRE).key(key).add(milliseconds).add(condition)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hexpireAt(byte[] key, long unixTimeSeconds, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIREAT).key(key).add(unixTimeSeconds)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hexpireAt(byte[] key, long unixTimeSeconds, ExpiryOption condition, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIREAT).key(key).add(unixTimeSeconds).add(condition)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpireAt(byte[] key, long unixTimeMillis, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIREAT).key(key).add(unixTimeMillis)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpireAt(byte[] key, long unixTimeMillis, ExpiryOption condition, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIREAT).key(key).add(unixTimeMillis).add(condition)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hexpireTime(String key, String... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIRETIME).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpireTime(String key, String... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIRETIME).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> httl(String key, String... fields) {
return new CommandObject<>(commandArguments(Command.HTTL).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpttl(String key, String... fields) {
return new CommandObject<>(commandArguments(Command.HPTTL).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hexpireTime(byte[] key, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HEXPIRETIME).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpexpireTime(byte[] key, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HPEXPIRETIME).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> httl(byte[] key, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HTTL).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpttl(byte[] key, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HPTTL).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpersist(String key, String... fields) {
return new CommandObject<>(commandArguments(Command.HPERSIST).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<Long>> hpersist(byte[] key, byte[]... fields) {
return new CommandObject<>(commandArguments(Command.HPERSIST).key(key)
.add(Keyword.FIELDS).add(fields.length).addObjects((Object[]) fields), BuilderFactory.LONG_LIST);
}
// Hash commands

// Set commands
Expand Down
194 changes: 194 additions & 0 deletions src/main/java/io/valkey/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
import io.valkey.params.GeoRadiusStoreParam;
import io.valkey.params.GeoSearchParam;
import io.valkey.params.GetExParams;
import io.valkey.params.HGetExParams;
import io.valkey.params.HSetExParams;
import io.valkey.params.LCSParams;
import io.valkey.params.LPosParams;
import io.valkey.params.LolwutParams;
Expand Down Expand Up @@ -4752,6 +4754,102 @@ public long hstrlen(final byte[] key, final byte[] field) {
return connection.executeCommand(commandObjects.hstrlen(key, field));
}

@Override
public List<byte[]> hgetex(byte[] key, HGetExParams params, byte[]... fields){
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hgetex(key, params, fields));
}

@Override
public long hsetex(byte[] key, HSetExParams params, byte[] field, byte[] value) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hsetex(key, params, field, value));
}

@Override
public long hsetex(byte[] key, HSetExParams params, Map<byte[], byte[]> hash){
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hsetex(key, params, hash));
}

@Override
public List<Long> hexpire(byte[] key, long seconds, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpire(key, seconds, fields));
}

@Override
public List<Long> hexpire(byte[] key, long seconds, ExpiryOption condition, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpire(key, seconds, condition, fields));
}

@Override
public List<Long> hpexpire(byte[] key, long milliseconds, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpire(key, milliseconds, fields));
}

@Override
public List<Long> hpexpire(byte[] key, long milliseconds, ExpiryOption condition, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpire(key, milliseconds, condition, fields));
}

@Override
public List<Long> hexpireAt(byte[] key, long unixTimeSeconds, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpireAt(key, unixTimeSeconds, fields));
}

@Override
public List<Long> hexpireAt(byte[] key, long unixTimeSeconds, ExpiryOption condition, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpireAt(key, unixTimeSeconds, condition, fields));
}

@Override
public List<Long> hpexpireAt(byte[] key, long unixTimeMillis, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpireAt(key, unixTimeMillis, fields));
}

@Override
public List<Long> hpexpireAt(byte[] key, long unixTimeMillis, ExpiryOption condition, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpireAt(key, unixTimeMillis, condition, fields));
}

@Override
public List<Long> hexpireTime(byte[] key, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpireTime(key, fields));
}

@Override
public List<Long> hpexpireTime(byte[] key, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpireTime(key, fields));
}

@Override
public List<Long> httl(byte[] key, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.httl(key, fields));
}

@Override
public List<Long> hpttl(byte[] key, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpttl(key, fields));
}

@Override
public List<Long> hpersist(byte[] key, byte[]... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpersist(key, fields));
}

@Override
public List<Object> xread(XReadParams xReadParams, Entry<byte[], byte[]>... streams) {
checkIsInMultiOrPipeline();
Expand Down Expand Up @@ -9347,6 +9445,102 @@ public long hstrlen(final String key, final String field) {
return connection.executeCommand(commandObjects.hstrlen(key, field));
}

@Override
public long hsetex(String key, HSetExParams params, String field, String value) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hsetex(key, params, field, value));
}

@Override
public long hsetex(String key, HSetExParams params, Map<String, String> hash) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hsetex(key, params, hash));
}

@Override
public List<String> hgetex(String key, HGetExParams params, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hgetex(key, params, fields));
}

@Override
public List<Long> hexpire(String key, long seconds, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpire(key, seconds, fields));
}

@Override
public List<Long> hexpire(String key, long seconds, ExpiryOption condition, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpire(key, seconds, condition, fields));
}

@Override
public List<Long> hpexpire(String key, long milliseconds, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpire(key, milliseconds, fields));
}

@Override
public List<Long> hpexpire(String key, long milliseconds, ExpiryOption condition, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpire(key, milliseconds, condition, fields));
}

@Override
public List<Long> hexpireAt(String key, long unixTimeSeconds, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpireAt(key, unixTimeSeconds, fields));
}

@Override
public List<Long> hexpireAt(String key, long unixTimeSeconds, ExpiryOption condition, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpireAt(key, unixTimeSeconds, condition, fields));
}

@Override
public List<Long> hpexpireAt(String key, long unixTimeMillis, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpireAt(key, unixTimeMillis, fields));
}

@Override
public List<Long> hpexpireAt(String key, long unixTimeMillis, ExpiryOption condition, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpireAt(key, unixTimeMillis, condition, fields));
}

@Override
public List<Long> hexpireTime(String key, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hexpireTime(key, fields));
}

@Override
public List<Long> hpexpireTime(String key, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpexpireTime(key, fields));
}

@Override
public List<Long> httl(String key, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.httl(key, fields));
}

@Override
public List<Long> hpttl(String key, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpttl(key, fields));
}

@Override
public List<Long> hpersist(String key, String... fields) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.hpersist(key, fields));
}

@Override
public String memoryDoctor() {
checkIsInMultiOrPipeline();
Expand Down
Loading
Loading