A Redis-compatible in-memory datastore implementation in Go, supporting core data structures and the RESP protocol.
- Data Types: Strings, Hashes (partial)
- Commands: 15+ Redis-compatible commands
- Persistence: TBD (Planned)
- Concurrency: Thread-safe with RW locks
- Protocol: RESP (Redis Serialisation Protocol)
- TTL: Time-based expiration with heap
make && ./redigo
telnet localhost 6389
| Command | Example | Description |
|---|---|---|
| SET | SET key value | Store string value |
| GET | GET key | Retrieve string value |
| HSET | HSET key field1 value1 ... | Set hash fields |
| HGET | HGET key field | Get hash field value |
| HGETALL | HGETALL key | Get all hash fields+values |
| HDEL | HDEL key field1 field2 ... | Delete hash fields |
| HEXISTS | HEXISTS key field | Check field existence |
| EXPIRE | EXPIRE key seconds | Set key expiration |
| TTL | TTL key | Get time to live |
| PING | PING | Server liveness check |
HSET key field1 value1 [field2 value2 ...]
Stores multiple hash fields.
Example:
127.0.0.1:6389> HSET user:1000 name "John" age 30
(integer) 2HGETALL key
Returns all fields and values in a hash.
Response:
1) "name"
2) "John"
3) "age"
4) "30"
HEXISTS key field
Returns if field exists in hash.
Return:
1if exists0if not exists
- Check if the server is running:
ps aux | grep redigo- Verify listening port:
lsof -i :6389- Verify the command is implemented in:
internal/server/handler.go - Check command spelling (Redis commands are uppercase)
To interact with your server using telnet, connect with:
telnet localhost 6389Once connected, you can send raw RESP commands, for example:
SET key valueBut to interact with your server, it's generally better to use telnet for testing as it allows you to send RESP commands directly.