A simple in-memory key-value cache database with CLI interface, implemented in C++20.
Modern C++ key-value store demonstrating idiomatic C++20 and best practices.
Prerequisites:
- C++20-capable compiler (GCC 12+ or Clang 15+)
- CMake 3.20+
- Ninja (recommended) or Make
Build Steps:
# Configure
cmake -S . -B build -G Ninja
# Build
cmake --build build
# Run tests
cmake --build build --target testOr using Make:
mkdir build && cd build
cmake ..
make
make test./build/khyberdb put key1 value1
./build/khyberdb get key1
./build/khyberdb delete key1
./build/khyberdb size# Run tests
cd build && ctest --output-on-failure
# Run benchmarks
./build/bench_khyberdbmaster: Stable C++ implementationrust-to-cpp20: Migration history (original port)
Standard commit messages with clear descriptions
clang-tidy:
clang-tidy src/*.cpp -checks=* -- -I src -std=c++20clang-format:
clang-format -i src/*.cpp src/*.hDebug build with sanitizers:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build
ctest --test-dir buildASAN and UBSAN are automatically enabled in Debug builds.
See ARCHITECTURE.md for system design and diagrams.
| Feature | Implementation |
|---|---|
| Key-Value Store | std::unordered_map<K, V> |
| Optional Returns | std::optional<T> |
| String Parameters | const std::string& |
| CLI Parsing | CLI11 |
| Module System | Headers + namespace |
- Simple cases:
std::optionalfor nullable returns - Complex errors: Would use
tl::expected<T, E>(dependency included)
- RAII for automatic cleanup
- No manual memory management required
- Single-threaded design (not thread-safe)
- Could be extended with mutex guards if needed
- Fork the repository
- Create a feature branch from
master - Make changes with tests
- Ensure CI passes
- Open a pull request
[To be specified]