Implemented LRU (Least Recently Used) Cache in Go with a REST API for "GET", "SET" and "DELETE" operations, and a Websocket endpoint to dynamically reflect the current state of the cache. The front end is built using React and Redux Toolkit (RTK) for state management
This project implements and LRU (Least Recently Used) Cache in Go with a REST API for "GET", "POST" and "DELETE" operations, and a Websocket endpoint to dynamically reflect the current state of the cache. The front end is built using React and Redux Toolkit (RTK) for state management
git clone https://github.com/Atharv7901/LRU-Cache
cd LRU-Cache
cd backend
go mod tidy
cd cmd
go run main.go
Open a New terminal window
cd frontend
npm install
npm run dev
GET /get?key={key}
: Get the CacheItem for the keyPOST /set
: Set a key-value pair with expiration. The request body should be a JSON object like{"key": "A", "value": "valueA", "expiration": 10}
DELETE /delete?key={key}
: Delete a CacheItemGET /cache/state
: Get the current state of the cachews://localhost:8000/ws
: Websocket endpoint to get real-time updates of the cache state.go test ./pkg/cache