Imbed is a lightweight in-memory key-value store (inspired by Redis) built in Java. Uses RESP for compatibility with existing Redis clients. No persistence.
Currently implemented features:
- TCP server that listens for connections on a specified port (default: 6379).
- Thread-safe storage using
ConcurrentHashMap. - Basic command execution via a
CommandExecutor(see supported commands in the Commands section). - Multiple clients can connect concurrently.
- Lightweight, minimal dependencies.
- No CLI support
docker pull 3akare/imbed:latestdocker run -d -p 6379:6379 --name imbed-server 3akare/imbed:latestThis will:
- Start the
imbedserver in a container. - Map container port
6379to host port6379.
docker stop imbed-serverdocker rm imbed-serverExample supported commands (will vary based on your CommandExecutor implementation):
| Command | Description | Example | Response (Success) |
|---|---|---|---|
PING |
Tests the connection | PING |
+PONG |
ECHO message |
Returns the given message | ECHO hello_world |
$11\r\nhello_world |
SET key value |
Stores a value under a key | SET name David |
+OK |
SET key value [EX|PX] ttl |
Stores a value with a time-to-live (seconds or milliseconds) | SET username 3akare EX 10 |
+OK |
GET key |
Retrieves the value of a key | GET name |
$5\r\nDavid |
DEL key |
Deletes a key-value pair | DEL name |
:1 |
KEYS |
Retrieves all keys | KEYS |
*1\r\n$4\r\nname |
EXPIRE key ttl |
Updates TTL of a key-value pair | EXPIRE name 20 |
:1 |
TTL key |
Retrieves remaining TTL of a key in seconds (-1 = no expire, -2 = not found) |
TTL name |
:10 |
- Default port is 6379.
- Server can be configured by editing the
mainmethod inMain.java. - Each client runs in its own thread to allow concurrent access.