https://github.com/aditya-narayan-sahoo/cache-api
A lightweight in-memory caching API with expiration, built with Node.js and Express
https://github.com/aditya-narayan-sahoo/cache-api
backend
Last synced: about 1 year ago
JSON representation
A lightweight in-memory caching API with expiration, built with Node.js and Express
- Host: GitHub
- URL: https://github.com/aditya-narayan-sahoo/cache-api
- Owner: aditya-narayan-sahoo
- Created: 2025-02-09T07:28:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-09T07:33:50.000Z (over 1 year ago)
- Last Synced: 2025-05-15T19:09:45.490Z (about 1 year ago)
- Topics: backend
- Language: JavaScript
- Homepage: https://cache-api-oykv.onrender.com/
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### **🗄️ Cache API - In-Memory Key-Value Store**
A lightweight in-memory caching API with expiration and LRU eviction, built with **Node.js** and **Express**, and deployed on **Render**.
---
## 🚀 **Features**
✅ Store key-value pairs with a **POST** request.
✅ Retrieve stored values using a **GET** request.
✅ Delete a key-value pair using a **DELETE** request.
✅ Automatic **expiration mechanism** (default: **1 min** per entry).
---
## 📌 **API Endpoints**
| Method | Endpoint | Description |
| -------- | ------------- | ----------------------- |
| `POST` | `/cache` | Store a key-value pair |
| `GET` | `/cache/:key` | Retrieve a value by key |
| `DELETE` | `/cache/:key` | Remove a key-value pair |
---
## 🛠️ **Tech Stack**
- **Node.js** + **Express**
- **Vercel Serverless Functions**
- **In-memory Caching (Map)**
---
## 🔧 **Installation**
Clone the repository:
```
git clone https://github.com/aditya-narayan-sahoo/cache-api.git
cd cache-api
```
Install dependencies:
```
npm install
```
Run locally:
```sh
npm start
OR
npm run dev
```
---
## 📝 **Environment Variables (Optional)**
Create a `.env` file for custom configuration:
```
PORT=3000
```
---