Skip to content

feat: add set commands - #27

Merged
kacy merged 1 commit into
mainfrom
feat/set-commands
Feb 6, 2026
Merged

feat: add set commands#27
kacy merged 1 commit into
mainfrom
feat/set-commands

Conversation

@kacy

@kacy kacy commented Feb 6, 2026

Copy link
Copy Markdown
Owner

summary

  • adds redis set data type (Value::Set(HashSet<String>))
  • implements SADD, SREM, SMEMBERS, SISMEMBER, SCARD commands
  • includes snapshot persistence and recovery support
  • adds memory tracking with per-member overhead accounting
  • empty sets are auto-deleted (matches redis behavior)

test plan

  • cargo test passes (474 tests)
  • cargo fmt clean
  • cargo clippy clean
  • set keyspace operations tested (add, remove, membership, cardinality)
  • command parsing tests for all 5 commands
  • type mismatch handling verified (WRONGTYPE errors)
  • readme updated with feature list and usage examples

design notes

set members are stored as String rather than Bytes since most set use cases involve string membership checks. memory overhead constants follow the same pattern as hash commands (base overhead + per-member overhead).

implements redis set data type with the core operations:
- SADD: add members to a set, returns count of new members
- SREM: remove members from a set, auto-deletes empty sets
- SMEMBERS: retrieve all members
- SISMEMBER: check membership
- SCARD: return set cardinality

includes snapshot persistence, memory tracking, and full test coverage.
@kacy
kacy merged commit 5f66fe2 into main Feb 6, 2026
5 checks passed
@kacy
kacy deleted the feat/set-commands branch February 7, 2026 20:06
kacy added a commit that referenced this pull request Feb 11, 2026
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.

1 participant