Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
76 changes: 76 additions & 0 deletions content/commands/himport-discard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
acl_categories:
- '@hash'
- '@slow'
arguments:
- display_text: fieldset-name
name: fieldset-name
type: string
arity: 3
categories:
- docs
- develop
- stack
- oss
- rs
- rc
- oss
- kubernetes
- clients
complexity: O(N) where N is the number of session-local fieldsets.
description: Removes a single session-local fieldset by name.
group: hash
hidden: false
hints:
- request_policy:all_shards
linkTitle: HIMPORT DISCARD
railroad_diagram: /images/railroad/himport-discard.svg
since: 8.10.0
summary: Removes a single session-local fieldset by name.
syntax_fmt: HIMPORT DISCARD fieldset-name
title: HIMPORT DISCARD
---
Removes a single session-local fieldset, previously defined with [`HIMPORT PREPARE`]({{< relref "/commands/himport-prepare" >}}), from the current connection.
Comment thread
dwdougherty marked this conversation as resolved.

## Required arguments

<details open><summary><code>fieldset-name</code></summary>

The name of the fieldset to remove from the current connection.

</details>

## Examples

```shell
> HIMPORT PREPARE u name email age
OK
> HIMPORT DISCARD u
(integer) 1
> HIMPORT DISCARD u
(integer) 0
```

## Redis Software and Redis Cloud compatibility

| Redis<br />Software | Redis<br />Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> |
|:----------------------|:-----------------|:------|
| <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> | <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> | |

## Return information

{{< multitabs id="himport-discard-return-info"
tab1="RESP2"
tab2="RESP3" >}}

[Integer reply](../../develop/reference/protocol-spec#integers): `1` if the fieldset was removed, or `0` if no fieldset with that name existed on the connection.

-tab-sep-

[Integer reply](../../develop/reference/protocol-spec#integers): `1` if the fieldset was removed, or `0` if no fieldset with that name existed on the connection.

{{< /multitabs >}}

## See also

[`HIMPORT PREPARE`]({{< relref "commands/himport-prepare/" >}}) | [`HIMPORT DISCARDALL`]({{< relref "commands/himport-discardall/" >}})
64 changes: 64 additions & 0 deletions content/commands/himport-discardall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
acl_categories:
- '@hash'
- '@slow'
arity: 2
categories:
- docs
- develop
- stack
- oss
- rs
- rc
- oss
- kubernetes
- clients
complexity: O(N) where N is the number of session-local fieldsets.
description: Removes all session-local fieldsets for the connection.
group: hash
hidden: false
hints:
- request_policy:all_shards
linkTitle: HIMPORT DISCARDALL
railroad_diagram: /images/railroad/himport-discardall.svg
since: 8.10.0
summary: Removes all session-local fieldsets for the connection.
syntax_fmt: HIMPORT DISCARDALL
title: HIMPORT DISCARDALL
---
Removes every fieldset held by the current connection, discarding all definitions previously created with [`HIMPORT PREPARE`]({{< relref "/commands/himport-prepare" >}}).

## Examples

```shell
> HIMPORT PREPARE u name email age
OK
> HIMPORT PREPARE o id total
OK
> HIMPORT DISCARDALL
(integer) 2
```

## Redis Software and Redis Cloud compatibility

| Redis<br />Software | Redis<br />Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> |
|:----------------------|:-----------------|:------|
| <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> | <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> | |

## Return information

{{< multitabs id="himport-discardall-return-info"
tab1="RESP2"
tab2="RESP3" >}}

[Integer reply](../../develop/reference/protocol-spec#integers): the number of fieldsets removed.

-tab-sep-

[Integer reply](../../develop/reference/protocol-spec#integers): the number of fieldsets removed.

{{< /multitabs >}}

## See also

[`HIMPORT PREPARE`]({{< relref "commands/himport-prepare/" >}}) | [`HIMPORT DISCARD`]({{< relref "commands/himport-discard/" >}})
92 changes: 92 additions & 0 deletions content/commands/himport-prepare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
acl_categories:
- '@hash'
- '@slow'
arguments:
- display_text: fieldset-name
name: fieldset-name
type: string
- display_text: field
multiple: true
name: field
type: string
arity: -4
categories:
- docs
- develop
- stack
- oss
- rs
- rc
- oss
- kubernetes
- clients
command_flags:
- denyoom
complexity: O(N*log(N)) where N is the number of fields.
description: Defines a session-local fieldset that maps a name to a sorted set of
field names.
group: hash
hidden: false
hints:
- request_policy:all_shards
linkTitle: HIMPORT PREPARE
railroad_diagram: /images/railroad/himport-prepare.svg
since: 8.10.0
summary: Defines a session-local fieldset that maps a name to a sorted set of field
names.
syntax_fmt: HIMPORT PREPARE fieldset-name field [field ...]
title: HIMPORT PREPARE
---
Defines a session-local fieldset that maps a name to an ordered list of field names, to be used by later [`HIMPORT SET`]({{< relref "/commands/himport-set" >}}) commands on the same connection.

## Required arguments

<details open><summary><code>fieldset-name</code></summary>

The name to give the fieldset. The fieldset is scoped to the current connection. Preparing a fieldset with a name that already exists on the connection replaces the previous definition.

</details>

<details open><summary><code>field [field ...]</code></summary>

One or more field names to store under the fieldset, in the order you intend to supply their values to [`HIMPORT SET`]({{< relref "/commands/himport-set" >}}). A field name must not appear more than once in the same fieldset.

</details>

## Examples

```shell
> HIMPORT PREPARE u name email age
OK
```

## Details

A fieldset is scoped to the client connection: it is not visible to other clients and is discarded when the connection closes or the client issues the [`RESET`]({{< relref "/commands/reset" >}}) command. A connection can prepare several fieldsets, each under its own name.

The command returns an error if the same field name is given more than once.

## Redis Software and Redis Cloud compatibility

| Redis<br />Software | Redis<br />Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> |
|:----------------------|:-----------------|:------|
| <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> | <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> | |

## Return information

{{< multitabs id="himport-prepare-return-info"
tab1="RESP2"
tab2="RESP3" >}}

[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`.

-tab-sep-

[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`.

{{< /multitabs >}}

## See also

[`HIMPORT SET`]({{< relref "commands/himport-set/" >}}) | [`HIMPORT DISCARD`]({{< relref "commands/himport-discard/" >}}) | [`HIMPORT DISCARDALL`]({{< relref "commands/himport-discardall/" >}})
127 changes: 127 additions & 0 deletions content/commands/himport-set.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
acl_categories:
- '@write'
- '@hash'
- '@slow'
arguments:
- display_text: key
key_spec_index: 0
name: key
type: key
- display_text: fieldset-name
name: fieldset-name
type: string
- display_text: value
multiple: true
name: value
type: string
arity: -5
categories:
- docs
- develop
- stack
- oss
- rs
- rc
- oss
- kubernetes
- clients
command_flags:
- write
- denyoom
complexity: O(N) where N is the number of fields in the fieldset.
description: Creates a fieldset-based hash from values supplied in the order matching
a previously prepared fieldset.
group: hash
hidden: false
key_specs:
- OW: true
begin_search:
spec:
index: 2
type: index
find_keys:
spec:
keystep: 1
lastkey: 0
limit: 0
type: range
update: true
linkTitle: HIMPORT SET
railroad_diagram: /images/railroad/himport-set.svg
since: 8.10.0
summary: Creates a fieldset-based hash from values supplied in the order matching
a previously prepared fieldset.
syntax_fmt: HIMPORT SET key fieldset-name value [value ...]
title: HIMPORT SET
---
Creates a hash from a fieldset previously defined with [`HIMPORT PREPARE`]({{< relref "/commands/himport-prepare" >}}), pairing the fieldset's field names with the supplied values by position.

## Required arguments

<details open><summary><code>key</code></summary>

The key to create. If the key already exists, it is overwritten.

</details>

<details open><summary><code>fieldset-name</code></summary>

The name of a fieldset previously defined with [`HIMPORT PREPARE`]({{< relref "/commands/himport-prepare" >}}) on the same connection.

</details>

<details open><summary><code>value [value ...]</code></summary>

The field values, given in the same order as the field names were declared in the fieldset. The number of values must equal the number of fields in the fieldset.

</details>

## Examples

```shell
> HIMPORT PREPARE u name email age
OK
> HIMPORT SET user:1 u alice a@example.com 30
OK
> HIMPORT SET user:2 u bob b@example.com 25
OK
> HGET user:1 name
"alice"
> HGET user:1 email
"a@example.com"
> HGET user:1 age
"30"
```

## Details

`HIMPORT SET` creates or overwrites `key` as a hash whose fields are the field names of the prepared fieldset, each paired with the value at the same position. The number of values must match the number of fields in the fieldset.

The command returns an error if the fieldset has not been prepared on the current connection, or if the number of values does not match the fieldset's field count.

Keys created this way behave exactly like any other hash and work with all existing hash commands. Because they share a fixed set of field names, Redis can store them with an internal encoding that keeps a single copy of the field names, reducing memory when many keys share the same layout.

## Redis Software and Redis Cloud compatibility

| Redis<br />Software | Redis<br />Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> |
|:----------------------|:-----------------|:------|
| <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> | <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> | |

## Return information

{{< multitabs id="himport-set-return-info"
tab1="RESP2"
tab2="RESP3" >}}

[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`.

-tab-sep-

[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`.

{{< /multitabs >}}

## See also

[`HIMPORT PREPARE`]({{< relref "commands/himport-prepare/" >}}) | [`HSET`]({{< relref "commands/hset/" >}}) | [`HIMPORT DISCARD`]({{< relref "commands/himport-discard/" >}})
Loading
Loading