{"id":47808119,"url":"https://github.com/jackhftang/lrucache.nim","last_synced_at":"2026-04-03T17:55:28.735Z","repository":{"id":44538072,"uuid":"255080127","full_name":"jackhftang/lrucache.nim","owner":"jackhftang","description":"LRU cache in pure nim","archived":false,"fork":false,"pushed_at":"2023-01-27T11:12:55.000Z","size":45,"stargazers_count":8,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-04-19T16:30:13.791Z","etag":null,"topics":["lru-cache","nim"],"latest_commit_sha":null,"homepage":"https://jackhftang.github.io/lrucache.nim/","language":"Nim","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/jackhftang.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}},"created_at":"2020-04-12T12:42:54.000Z","updated_at":"2022-12-13T18:39:18.000Z","dependencies_parsed_at":"2023-02-15T08:31:29.958Z","dependency_job_id":null,"html_url":"https://github.com/jackhftang/lrucache.nim","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/jackhftang/lrucache.nim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackhftang%2Flrucache.nim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackhftang%2Flrucache.nim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackhftang%2Flrucache.nim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackhftang%2Flrucache.nim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackhftang","download_url":"https://codeload.github.com/jackhftang/lrucache.nim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackhftang%2Flrucache.nim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31367587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T17:53:18.093Z","status":"ssl_error","status_checked_at":"2026-04-03T17:53:17.617Z","response_time":107,"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":["lru-cache","nim"],"created_at":"2026-04-03T17:55:28.108Z","updated_at":"2026-04-03T17:55:28.718Z","avatar_url":"https://github.com/jackhftang.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LRU cache\n\nA common implemenation of LRU cache (hash table + doubly-linked list). \nAll operations are in time complexity of O(1).\nThis implementation is *not* thread-safe.\n\n## Installation\n\n```\n$ nimble install lrucache\n```\n\n## API\n\nSee [here](https://jackhftang.github.io/lrucache.nim/)\n\n## Usage\n\n```nim\n# create a new LRU cache with initial capacity of 1 items\nlet cache = newLRUCache[int, string](1) \n\ncache[1] = \"a\"\ncache[2] = \"b\"\n\n# key 1 is not in cache, because key 1 is eldest and capacity is only 1\nassert: 1 notin cache \nassert: 2 in cache\n\n# increase capacity and add key 1 \ncache.capacity = 2 \ncache[1] = \"a\"\nassert: 1 in cache\nassert: 2 in cache\n\n# update recentness of key 2 and add key 3, then key 1 will be discarded.\necho cache[2]\ncache[3] = \"c\"\nassert: 1 notin cache\nassert: 2 in cache\nassert: 3 in cache\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackhftang%2Flrucache.nim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackhftang%2Flrucache.nim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackhftang%2Flrucache.nim/lists"}