Skip to content
Multiple Keys & Overwrite
step 1/3

Reading — step 1 of 3

Multiple Keys & DBSIZE

~1 min readString Commands

Multiple Keys & Overwrite

Your SET/GET from the previous lesson works for single keys. Now let's handle real-world patterns.

Overwriting

Setting a key that already exists replaces the value silently:

SET name Alice  → +OK
SET name Bob    → +OK
GET name        → Bob (not Alice)

Quoted Values

Values with spaces need quoting: SET greeting "hello world"

Your argument parser needs to handle double-quoted strings — everything between "..." is a single argument.

DBSIZE

DBSIZE returns the total number of keys in the database as a RESP integer: :<count>\r\n

This is useful for debugging and testing.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…

Multiple Keys & Overwrite — Build Redis from Scratch