{"id":26826727,"url":"https://github.com/hslam/lru","last_synced_at":"2025-03-30T11:30:45.692Z","repository":{"id":57564479,"uuid":"335563247","full_name":"hslam/lru","owner":"hslam","description":"Package lru implements an LRU cache.","archived":false,"fork":false,"pushed_at":"2021-12-28T15:15:11.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-07-27T18:04:44.519Z","etag":null,"topics":["cache","go","golang","lru"],"latest_commit_sha":null,"homepage":"","language":"Go","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/hslam.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}},"created_at":"2021-02-03T08:56:34.000Z","updated_at":"2021-12-28T15:15:14.000Z","dependencies_parsed_at":"2022-09-18T04:51:48.094Z","dependency_job_id":null,"html_url":"https://github.com/hslam/lru","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Flru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Flru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Flru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Flru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hslam","download_url":"https://codeload.github.com/hslam/lru/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246313699,"owners_count":20757446,"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","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","go","golang","lru"],"created_at":"2025-03-30T11:30:44.841Z","updated_at":"2025-03-30T11:30:45.680Z","avatar_url":"https://github.com/hslam.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lru\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/hslam/lru)](https://pkg.go.dev/github.com/hslam/lru)\n[![Build Status](https://github.com/hslam/lru/workflows/build/badge.svg)](https://github.com/hslam/lru/actions)\n[![codecov](https://codecov.io/gh/hslam/lru/branch/master/graph/badge.svg)](https://codecov.io/gh/hslam/lru)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hslam/lru)](https://goreportcard.com/report/github.com/hslam/lru)\n[![LICENSE](https://img.shields.io/github/license/hslam/lru.svg?style=flat-square)](https://github.com/hslam/lru/blob/master/LICENSE)\n\nPackage lru implements an LRU cache.\n\n## Get started\n\n### Install\n```\ngo get github.com/hslam/lru\n```\n### Import\n```\nimport \"github.com/hslam/lru\"\n```\n### Usage\n#### Example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/hslam/lru\"\n)\n\nfunc main() {\n\tvar capacity = 1024\n\tvar free lru.Free = func(key, value interface{}) {}\n\tl := lru.New(capacity, free)\n\tkey := 1\n\tvalue := \"Hello world\"\n\tcost := len(value)\n\tr := l.Set(key, value, cost)\n\tr.Done()\n\tif v, r, ok := l.Get(key); ok {\n\t\tfmt.Println(v)\n\t\tr.Done()\n\t}\n\tl.Remove(key)\n\tl.Reset()\n}\n```\n\n### Output\n```\nHello world\n```\n\n### License\nThis package is licensed under a MIT license (Copyright (c) 2021 Meng Huang)\n\n\n### Author\nlru was written by Meng Huang.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Flru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhslam%2Flru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Flru/lists"}