This project is a simplified NoSQL in-memory key-value store implemented in C++ with a Python client for interaction, heavily inspired by Redis. It supports basic operations like SET, GET, and DEL, with data persistence to a file. The server handles multiple client connections using multithreading.
- Basic Commands:
SET <key> <value>: Stores a key-value pair.GET <key>: Retrieves the value for the specified key.DEL <key>: Deletes the specified key.
- Persistence: Data is saved to and loaded from a file (
database.txt). - Multithreading: Handles multiple client connections concurrently using
std::threadandstd::mutex.
- C++ for server-side implementation
- Python for the client
- Winsock API for network communication
- Multithreading:
std::thread,std::mutex - File I/O:
fstreamfor data persistence
- Windows Operating System
- C++ compiler (e.g., MSVC for Windows)
- Python 3.x
- CMake
- Visual Studio Build Tools or MinGW (for
makesupport)
- Clone the repository:
git clone https://github.com/TateCharboneau/Redis-From-Scratch cd Redis-From-Scratch - Create a build directory:
mkdir build cd build - Configure and build the project:
cmake .. cmake --build .
- Install MinGW and add it to your system PATH.
- Open the MinGW terminal in the project directory.
- Run:
mingw32-make
cd build/Release
.\RedisServer.exe- Open a new terminal window.
- Navigate to the project directory.
- Run the client:
python RedisClient.py
Enter command (or 'QUIT' to exit): SET name Alice
Server response: OK
Enter command (or 'QUIT' to exit): GET name
Server response: Alice
Enter command (or 'QUIT' to exit): DEL name
Server response: OK- Implemented a network server with socket programming.
- Managed concurrent client connections using multithreading.
- Ensured data consistency with thread-safe operations.
- Integrated file I/O for data persistence.
- Expand supported commands (e.g.,
EXPIRE,INCR). - Implement more robust error handling.
- Port to Unix-based systems with cross-platform sockets.
This project is open-source and free to use under the MIT License.