Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Documentation for DIGEST and DELEX Commands

  • Create documentation for DIGEST command at docs/command-reference/strings/digest.md
  • Create documentation for DELEX command at docs/command-reference/generic/delex.md
  • Update compatibility matrix in docs/command-reference/compatibility.md to include both commands
  • Update JSON data in src/components/CompatibilityTable/data.json to include both commands
  • Build and validate the documentation site
  • Request code review
  • Run security checks (no code changes, documentation only)
  • Update with actual DIGEST values from ghcr.io/dragonflydb/dragonfly-dev:ubuntu
  • Remove Redis compatibility FAQs
  • Add Dragonfly v1.37.0 availability information
  • Remove compressed strings mention (Dragonfly doesn't compress strings)

Summary

This PR adds comprehensive documentation for the new DIGEST and DELEX commands introduced in dragonflydb/dragonfly#6328. Both commands are available in Dragonfly v1.37.0 and later.

DIGEST Command

  • Location: docs/command-reference/strings/digest.md
  • Returns XXH3 hash digest as 16-character hex string
  • Time complexity: O(N) where N is the length of the string value
  • ACL categories: @READ, @string, @fast
  • All examples verified with actual digest outputs from dragonfly-dev container
  • Handles raw strings and integer-encoded strings

DELEX Command

  • Location: docs/command-reference/generic/delex.md
  • Conditionally deletes keys based on value or digest comparison
  • Supports IFEQ, IFNE, IFDEQ, IFDNE options
  • Time complexity varies by mode (O(1) to O(N))
  • ACL categories: @keyspace, @Write, @fast
  • All examples verified with actual digest values

Recent Changes

  • ✅ Removed mention of "compressed strings" from DIGEST FAQ (Dragonfly doesn't compress strings)
  • ✅ Updated FAQ question title to reflect only integer-encoded strings

Validation

✅ Documentation site builds successfully with yarn build
✅ All digest values verified against actual Dragonfly dev container
✅ Redis compatibility questions removed
✅ Version availability information added
✅ Accurate information about string encoding support

Original prompt

Add Documentation for DELEX and DIGEST Commands

Overview

Add documentation pages for the new DELEX and DIGEST commands that were implemented in dragonflydb/dragonfly#6328. These commands are Redis 8.4.0 compatible and enable atomic conditional string operations.

Commands to Document

1. DIGEST Command

Location: Create docs/command-reference/strings/digest.md

Command Details:

  • Syntax: DIGEST key
  • Description: Returns XXH3 hash digest as 16-character hex string for the value stored at key
  • Time complexity: O(N) where N is the length of the string value
  • ACL categories: @READ, @string, @fast
  • Return Values:
    • Returns a 16-character hexadecimal string (XXH3 64-bit hash)
    • Returns nil if the key does not exist
    • Returns WRONGTYPE error if the key exists but is not a string type
  • Compatibility: Redis 8.4.0+, Dragonfly
  • Implementation Notes:
    • Uses XXH3 hashing algorithm
    • Handles tiered storage
    • Handles all string encodings (raw, integer-encoded, compressed)

Example Content Structure (follow pattern from docs/command-reference/strings/get.md):

---
description: Learn how to use Redis DIGEST command to compute hash digest of string values.
---

import PageTitle from '@site/src/components/PageTitle';

# DIGEST

<PageTitle title="Redis DIGEST Command (Documentation) | Dragonfly" />

## Introduction

The `DIGEST` command returns a hash digest for the value stored at a specified key.
It uses the XXH3 hashing algorithm to compute a 64-bit hash and returns it as a 16-character hexadecimal string.
This command is useful for comparing values without transferring the full content, implementing checksums, or detecting changes.

## Syntax

```shell
DIGEST key

Time complexity: O(N) where N is the length of the string value

ACL categories: @READ, @string, @fast

Parameter Explanations

  • key: The key whose value should be hashed. Must be a string type.

Return Values

  • Returns a 16-character hexadecimal string representing the XXH3 64-bit hash of the value.
  • Returns nil if the key does not exist.
  • Returns an error if the key exists but holds a non-string value type.

Code Examples

Basic Example

Compute digest of a string value:

dragonfly$> SET mykey "Hello, Dragonfly!"
OK
dragonfly$> DIGEST mykey
"d4f3c8b2a1e6f7d9"

Non-Existent Key

If the key does not exist, DIGEST returns nil:

dragonfly$> DIGEST non_existent_key
(nil)

Digest Consistency

The same value always produces the same digest:

dragonfly$> SET key1 "test"
OK
dragonfly$> SET key2 "test"
OK
dragonfly$> DIGEST key1
"a1b2c3d4e5f67890"
dragonfly$> DIGEST key2
"a1b2c3d4e5f67890"

Different Values Produce Different Digests

dragonfly$> SET key1 "hello"
OK
dragonfly$> SET key2 "world"
OK
dragonfly$> DIGEST key1
"1234567890abcdef"
dragonfly$> DIGEST key2
"fedcba0987654321"

Error on Wrong Type

dragonfly$> LPUSH mylist "item"
(integer) 1
dragonfly$> DIGEST mylist
(error) WRONGTYPE Operation against a key holding the wrong kind of value

Best Practices

  • Use DIGEST to compare values efficiently without transferring full content over the network.
  • Implement change detection mechanisms by storing and comparing digests.
  • Use with DELEX IFDEQ/IFDNE for conditional deletions based on digest matching.

Common Mistakes

  • Attempting to use DIGEST on non-string keys will result in a WRONGTYPE error.
  • Assuming different values might produce the same digest (hash collisions are extremely rare with XXH3).

FAQs

What hashing algorithm does DIGEST use?

DIGEST uses the XXH3 algorithm, which is a fast, non-cryptographic hash function that produces a 64-bit hash value.

Is DIGEST suitable for cryptographic purposes?

No, DIGEST uses XXH3 which is not a cryptographic hash function. For cryptographic purposes, use dedicated cryptographic hash functions.

Can DIGEST work with compressed or integer-encoded strings?

Yes, DIGEST handles all string encodings including raw strings, integer-encoded strings, and compressed strings.

Is DIGEST compatible with Redis?

Yes, DIGEST is compatible with Redis 8.4.0 and later versions.


### 2. DELEX Command

**Location:** Create `docs/command-reference/generic/delex.md`

**Command Details:**
- **Syntax:** `DELEX key [IFEQ|IFNE|IFDEQ|IFDNE value]`
- **Description:** Conditionally deletes a key based on value or digest comparison
- **Time complexity:** 
  - O(1) when no condition is specified (delegates to DEL)
  - O(min(M,N)) for IFEQ/IFNE where M and N are value lengths
  - O(N) for IFDEQ/IFDNE where N is the length of the stored string value
- **ACL categories:** @keyspace, @write, @fast
- **Return Values:** Returns 0 or 1 (number of keys deleted)
- **Options:**
  - `IFEQ value` - delete if value matches
  - `IFNE value` - delete if value differs
  - `IFDEQ digest` - delete if dig...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for you](https://github.com/dragonflydb/documentation/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link

vercel bot commented Jan 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
documentation Ready Ready Preview, Comment Jan 22, 2026 1:42pm

Request Review

Co-authored-by: romange <3674760+romange@users.noreply.github.com>
Copilot AI changed the title [WIP] Add documentation for DELEX and DIGEST commands Add documentation for DIGEST and DELEX commands Jan 22, 2026
Copilot AI requested a review from romange January 22, 2026 12:38

`DELEX` extends [`DEL`](./del.md) by adding conditional deletion based on value or digest matching. Without conditions, `DELEX key` behaves identically to `DEL key`.

### Is DELEX compatible with Redis?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

  1. remove Redis compatibility questions.
  2. verify DIGEST output on your examples by running ghcr.io/dragonflydb/dragonfly-dev:ubuntu and checking the output against this container that supports DIGEST and DELEX commands.
  3. align the examples to have correct digest strings
  4. Mention for both commands that they are available for Dragonfly v1.37.0 or later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit dca7180:

  1. ✅ Removed Redis compatibility questions from both documents
  2. ✅ Verified all DIGEST outputs using ghcr.io/dragonflydb/dragonfly-dev:ubuntu container and updated examples with correct values
  3. ✅ Aligned all examples with actual digest strings (e.g., "test" → "9ec9f7918d7dfc40", "hello" → "9555e8555c62dcfd", etc.)
  4. ✅ Added "Availability: Dragonfly v1.37.0 and later" to both command documents

All digest values have been verified against the dev container and are now accurate.

Co-authored-by: romange <3674760+romange@users.noreply.github.com>
@romange romange marked this pull request as ready for review January 22, 2026 13:27
Copilot AI requested a review from romange January 22, 2026 13:28

### Can DIGEST work with compressed or integer-encoded strings?

Yes, `DIGEST` handles all string encodings including raw strings, integer-encoded strings, and compressed strings.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove compressed mention as there are no compression of strings in Dragonfly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit 6e8daf3. Removed all mentions of "compressed" strings from the DIGEST documentation. The FAQ now reads:

"Can DIGEST work with integer-encoded strings?"

"Yes, DIGEST handles all string encodings including raw strings and integer-encoded strings."

Co-authored-by: romange <3674760+romange@users.noreply.github.com>
Copy link
Contributor

@vyavdoshenko vyavdoshenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants