{"id":31913585,"url":"https://github.com/zhibirc/ururu","last_synced_at":"2025-10-13T18:51:15.847Z","repository":{"id":57387772,"uuid":"455529921","full_name":"zhibirc/ururu","owner":"zhibirc","description":"No :bird: URURU, just LRU (and friends)","archived":false,"fork":false,"pushed_at":"2023-12-14T23:06:08.000Z","size":171,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-16T17:27:46.284Z","etag":null,"topics":["cache","caching","fifo-cache","lru-cache","optimization","optimization-algorithms","performance","random-replacement-algorithm","replacement-policy","slru-cache","ttl-cache"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/zhibirc.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}},"created_at":"2022-02-04T11:55:33.000Z","updated_at":"2023-11-29T22:18:13.000Z","dependencies_parsed_at":"2023-12-13T23:36:12.435Z","dependency_job_id":null,"html_url":"https://github.com/zhibirc/ururu","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zhibirc/ururu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhibirc%2Fururu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhibirc%2Fururu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhibirc%2Fururu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhibirc%2Fururu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhibirc","download_url":"https://codeload.github.com/zhibirc/ururu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhibirc%2Fururu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016623,"owners_count":26085853,"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-13T02:00:06.723Z","response_time":61,"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":["cache","caching","fifo-cache","lru-cache","optimization","optimization-algorithms","performance","random-replacement-algorithm","replacement-policy","slru-cache","ttl-cache"],"created_at":"2025-10-13T18:49:56.023Z","updated_at":"2025-10-13T18:51:15.841Z","avatar_url":"https://github.com/zhibirc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ururu\n\n[![Maintenance](https://img.shields.io/maintenance/yes/2023.svg?style=flat)]()\n![GitHub repo size](https://img.shields.io/github/repo-size/zhibirc/ururu?style=flat\u0026color=008080)\n![Static Badge](https://img.shields.io/badge/cache_algorithms-7-f0e68c)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg?style=flat)]()\n\n\u003cp align=\"center\"\u003e\n    \u003cimg width=\"200\" src=\"ururu.jpeg\"\u003e\n\u003c/p\u003e\n\n---\n\n## Table of Contents\n\n🐢 [First-In-First-Out (FIFO) Cache](./fifo-cache/)\n\n🐝 [Random Replacement (RR) Cache](./rr-cache/)\n\n\u003e [!TIP]\n\u003e Code is ready for copy-paste. Use plain TS files or JS + type annotations, whatever you need.\n\n## Motivation\n\nYet another cache implementations. But why? Yeah, there are a few reasons for that.\n\n**Major reasons:**\n\n1. Research.\n2. Education.\n3. Fun.\n\n**Minor reasons:**\n\n1. To produce ready-to-use library well enough to just copy-paste into real project.\n\nThere are also several let's say acceptance criteria and non-functional requirements which I follow here:\n\n1. Simplicity in implementation means better _maintainability_.\n\nIf in general it's usually true, this is very subjective if applied to implementations in this repository. Despite the fact that I try to maintain the lowest complexity level as it's possible and reasonable (without damage to performance in the first place), some specific decisions could probably be simplified.\n\n2. Simplicity in interface means better _learnability_ (see \"ISO/IEC 9126 Software engineering — Product quality\").\n\n3. Zero dependencies to achieve better _predictability_, _safety_, reduces overall application _size_ and CI/CD duration.\n\n## General Theory\n\nWhen the cache becomes full, a cache block or record/entry must be evicted to make room for a new block. The replacement policy determines which block to evict.\n\nVarious cache implementations can have slightly different public APIs, however most of them are very consistent in their core capabilities. In the list below there are typical extra features which can be found in known cache realisations (as part of their public API):\n\n| Member  | Type   | Description                                                                         |\n|---------|--------|-------------------------------------------------------------------------------------|\n|`size`   |property|Number of entries/items/records actually stored in cache ($size \u003c= capacity$).       |\n|`from`   |static  |Instantiate cache with data (usually key-value structure).                           |\n|`setpop` |method  |Sets a value for the given key, but besides that returns evicted object or old value.|\n|`peek`   |method  |Retrieves the value associated with the given key, doesn't update access information.|\n|`forEach`|method  |Convenient helper methods implementing the ability to iterate on cache data.         |\n|`keys`   |method  |                                                                                     |\n|`values` |method  |                                                                                     |\n|`entries`|method  |                                                                                     |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhibirc%2Fururu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhibirc%2Fururu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhibirc%2Fururu/lists"}