@Experimental public final class HashImport extends java.lang.Object implements java.lang.AutoCloseable
HIMPORT (Hinted Hash Templates, Redis 8.10): declare
the ordered field names once, then create many hashes by sending only their values with
himportSet.
A template may be reused across keys, calls, and connections; the server-side
PREPARE/DISCARD lifecycle is managed by the client and never exposed. Close the
template when done (it is AutoCloseable), preferably with try-with-resources; after
close() it must not be used again. A template dropped without close() leaves
stale server-side state behind until its connections are recycled.
try (HashImport fs = HashImport.of("name", "email", "age")) {
jedis.himportSet("u:1", fs, "alice", "a@x.com", "25");
jedis.himportSet("u:2", fs, "bob", "b@x.com", "30");
}
A template must declare at least one field, with no null, empty, or duplicate names. Each
himportSet supplies exactly one value per field, in field order; the keys it produces are
ordinary hashes.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Discards this template; it must not be used again afterwards.
|
boolean |
isDiscarded() |
static HashImport |
of(byte[]... fields)
Creates a template from the given binary field names.
|
static HashImport |
of(java.lang.String... fields)
Creates a template from the given
String field names. |
public static HashImport of(java.lang.String... fields)
String field names.fields - the ordered field names; must be non-empty with no null, empty, or
duplicate entriespublic static HashImport of(byte[]... fields)
fields - the ordered field names; must be non-empty with no null, empty, or
duplicate entries (duplicates are compared by content).public boolean isDiscarded()
true once close() has been calledpublic void close()
close in interface java.lang.AutoCloseableCopyright © 2026. All rights reserved.