{"id":15095940,"url":"https://github.com/atharv7901/lru-cache","last_synced_at":"2026-02-07T06:01:35.513Z","repository":{"id":250337334,"uuid":"834182701","full_name":"Atharv7901/LRU-Cache","owner":"Atharv7901","description":"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","archived":false,"fork":false,"pushed_at":"2024-08-09T12:39:03.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-29T09:59:09.963Z","etag":null,"topics":["gin-gonic","golang","mutex-lock","reactjs","redux","redux-toolkit","websocket"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Atharv7901.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-26T15:44:59.000Z","updated_at":"2024-08-09T12:40:09.000Z","dependencies_parsed_at":"2024-08-09T14:24:27.333Z","dependency_job_id":null,"html_url":"https://github.com/Atharv7901/LRU-Cache","commit_stats":null,"previous_names":["atharv7901/lru-cache"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Atharv7901/LRU-Cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atharv7901%2FLRU-Cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atharv7901%2FLRU-Cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atharv7901%2FLRU-Cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atharv7901%2FLRU-Cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Atharv7901","download_url":"https://codeload.github.com/Atharv7901/LRU-Cache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atharv7901%2FLRU-Cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29187935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T05:07:31.176Z","status":"ssl_error","status_checked_at":"2026-02-07T05:06:15.227Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gin-gonic","golang","mutex-lock","reactjs","redux","redux-toolkit","websocket"],"created_at":"2024-09-25T15:44:06.522Z","updated_at":"2026-02-07T06:01:35.488Z","avatar_url":"https://github.com/Atharv7901.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LRU Cache with Rest API and Websocket\nThis 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.\nThe front end is built using React and Redux Toolkit (RTK) for state management\n\n## Features\n- LRU cache with capacity as 5, and configurable expiration time for items\n- Concurrent-safe operations on the cache\n- Added mutex locks to handle concurrent operations\n- REST API endpoints to interact with the cache\n- Websocket endpoint to reflect real-time state of the cache\n- React front end to consume the API and display the cache state\n- Redux Toolkit (RTK) for state management\n- Unit test cases to check edge cases\n\n## Getting Started\n### Prerequisites\n- Go 1.19 or higher\n- Node.js and npm or yarn\n\n### Backend Setup\n1. Clone the Repository\n    ```sh\n    git clone https://github.com/Atharv7901/LRU-Cache\n2. Open the cloned Repository\n    ```sh\n    cd LRU-Cache\n3. Navigate to backend directory\n    ```sh\n    cd backend\n4. Install dependencies\n    ```sh\n    go mod tidy\n5. Navigate to cmd\n    ```sh\n    cd cmd\n6. Run the backend server\n    ```sh\n    go run main.go\n### Frontend Setup\nOpen a New terminal window\n1. Navigate to front end directory\n    ```sh\n    cd frontend\n2. Install dependencies\n    ```sh\n    npm install\n3. Start the front end development server:\n    ```sh\n    npm run dev\n## API Endpoints\n- `GET /get?key={key}`: Get the CacheItem for the key\n- `POST /set`: Set a key-value pair with expiration. The request body should be a JSON object like \n`{\"key\": \"A\", \"value\": \"valueA\", \"expiration\": 10}`\n- `DELETE /delete?key={key}`: Delete a CacheItem\n- `GET /cache/state`: Get the current state of the cache\n- `ws://localhost:8000/ws`: Websocket endpoint to get real-time updates of the cache state.\n\n## Running Tests\n1. Navigate to backend directory and type the command\n    ```sh\n    go test ./pkg/cache\n## Acknowledgments\n- [Gin](https://github.com/gin-gonic/gin) for the HTTP web framework\n- [Gorilla Websocket](https://github.com/gorilla/websocket) for Websocket support\n- [React](https://reactjs.org) and [Redux Toolkit](https://redux-toolkit.js.org) for the front end\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatharv7901%2Flru-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatharv7901%2Flru-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatharv7901%2Flru-cache/lists"}