Skip to content

3akare/imbed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Imbed

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.

Features

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

Run with Docker

1. Pull the Docker image

docker pull 3akare/imbed:latest

2. Run the container

docker run -d -p 6379:6379 --name imbed-server 3akare/imbed:latest

This will:

  • Start the imbed server in a container.
  • Map container port 6379 to host port 6379.

3. Stop the container

docker stop imbed-server

4. Remove the container

docker rm imbed-server

Commands

Example 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

⚙️ Development Notes

  • Default port is 6379.
  • Server can be configured by editing the main method in Main.java.
  • Each client runs in its own thread to allow concurrent access.

About

In-memory key-value store inspired by Redis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published