{"id":31856637,"url":"https://github.com/vedanty3/use-lru-cache","last_synced_at":"2025-10-12T14:20:51.703Z","repository":{"id":210503008,"uuid":"726521456","full_name":"vedanty3/use-lru-cache","owner":"vedanty3","description":"A React hook for managing an LRUCache (Least Recently Used Cache) in your React components.","archived":false,"fork":false,"pushed_at":"2023-12-31T07:02:04.000Z","size":40,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-12T06:59:07.313Z","etag":null,"topics":["api-caching","caching-strategies","customhook","doubly-linked-list","hashmap","javascript","lru-cache","npm-package","react","react-hooks","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/use-lru-cache","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vedanty3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2023-12-02T16:21:48.000Z","updated_at":"2024-08-12T18:33:18.000Z","dependencies_parsed_at":"2025-05-25T11:03:05.784Z","dependency_job_id":"25324304-85d2-4140-a3ab-af4a672b6fd2","html_url":"https://github.com/vedanty3/use-lru-cache","commit_stats":null,"previous_names":["uuvedant4/use-lru-cache","vedantyetekar/use-lru-cache"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vedanty3/use-lru-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vedanty3%2Fuse-lru-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vedanty3%2Fuse-lru-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vedanty3%2Fuse-lru-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vedanty3%2Fuse-lru-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vedanty3","download_url":"https://codeload.github.com/vedanty3/use-lru-cache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vedanty3%2Fuse-lru-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011048,"owners_count":26084865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api-caching","caching-strategies","customhook","doubly-linked-list","hashmap","javascript","lru-cache","npm-package","react","react-hooks","typescript"],"created_at":"2025-10-12T14:20:46.188Z","updated_at":"2025-10-12T14:20:51.698Z","avatar_url":"https://github.com/vedanty3.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ****useLRUCache🪝****\n\nA React hook for managing an LRUCache (Least Recently Used Cache) in your React components.\n\n### Installation\n\n```bash\nnpm install use-lru-cache\n```\n\n### Usage\n\n```typescript\nimport React from \"react\";\nimport { useLRUCache } from \"use-lru-cache\";\n\ntype T = number;\n\nconst App: React.FC = () =\u003e {\n  // Initialize an LRUCache with a capacity of 10 for numbers\n  // It will hold a value of type number against keys\n  const { get, put, getCachedData, clearCache } = useLRUCache\u003cT\u003e(10);\n\n  const cachedValue = get(\"someKey\"); // returns corresponding value if key is present else null.\n  put(\"someKey\", 42); // set key as \"someKey\" and corresponding value will be 42\n  const cachedKeys = getCachedData(); // will return an array of all present keys\n\n  return (\n    \u003cdiv\u003e\n      \u003cp\u003eCached Value: {cachedValue}\u003c/p\u003e\n      {/* Render other components or UI elements */}\n    \u003c/div\u003e\n  );\n};\n\nexport default App;\n```\n\n\u003e _Note: Replace `someKey` and `42` with your actual key and data. Adjust the generic type parameter \u003cT\u003e based on the type of data you want to store in the cache corresponding to your key. A key can be a number or string._\n\n###### _Example: [use-lru-cache.vercel.app](https://use-lru-cache.vercel.app)_\n\n###### _Checkout `use-lru-cache` on [npm](https://www.npmjs.com/package/use-lru-cache)_\n\n###### _Contributors_\n\n\u003cdiv style=\"text-align: center; background-color: #f8f9fa; padding: 20px; border-radius: 10px; box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); display: inline-block;\"\u003e\n  \u003ca href=\"https://github.com/uuvedant4/use-lru-cache/graphs/contributors\" style=\"text-decoration: none;\"\u003e\n    \u003cimg src=\"https://contrib.rocks/image?repo=uuvedant4/use-lru-cache\" style=\"width: 150px; height: auto; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvedanty3%2Fuse-lru-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvedanty3%2Fuse-lru-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvedanty3%2Fuse-lru-cache/lists"}