Absolutely! Here’s the full, copy-paste-ready README.md in proper Markdown format for your GitHub repo:
⸻
A simple key-value store with TTL support, built using Spring Boot and MySQL. Supports setting, retrieving, and soft-deleting keys with automatic expiration.
brew install mysql
brew services start mysql
mysql -u root
CREATE DATABASE kv_store;
CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON kv_store.* TO 'your_username'@'localhost';
FLUSH PRIVILEGES;
⸻
mvn clean spring-boot:run
Make sure application.properties or db.properties is properly configured with your DB credentials.
⸻
Base URL: http://localhost:8080/api/kv/
⸻
curl -X GET http://localhost:8080/api/kv/ \
-H "Content-Type: application/json" \
-d '{"key": "myKey"}'
⸻
curl -X PUT http://localhost:8080/api/kv/ \
-H "Content-Type: application/json" \
-d '{"key": "myKey", "value": "myValue", "expiry": "expiry_in_minutes"}'
⸻
curl -X DELETE http://localhost:8080/api/kv/ \
-H "Content-Type: application/json" \
-d '{"key": "myKey"}'
⸻
• Keys auto-expire after the specified TTL (expiry in minutes).
• A scheduled CRON job runs every 3 minutes to purge expired keys.
• Soft-deleted keys are manually expired and can be differentiated from auto-expired ones.
⸻
• Java 17
• Spring Boot
• MySQL
• Flyway (for DB migrations)
• Hibernate (JPA)
• Maven