{"id":21056544,"url":"https://github.com/souravray/lru","last_synced_at":"2025-03-14T00:20:17.517Z","repository":{"id":57604829,"uuid":"210139285","full_name":"souravray/lru","owner":"souravray","description":"Another LRU Cache implemented in GO","archived":false,"fork":false,"pushed_at":"2019-09-23T09:31:53.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-20T19:24:33.878Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/souravray.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":"2019-09-22T11:56:06.000Z","updated_at":"2019-09-23T09:31:55.000Z","dependencies_parsed_at":"2022-09-26T20:01:09.927Z","dependency_job_id":null,"html_url":"https://github.com/souravray/lru","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souravray%2Flru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souravray%2Flru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souravray%2Flru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souravray%2Flru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/souravray","download_url":"https://codeload.github.com/souravray/lru/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243500739,"owners_count":20300775,"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":[],"created_at":"2024-11-19T16:51:34.663Z","updated_at":"2025-03-14T00:20:17.487Z","avatar_url":"https://github.com/souravray.png","language":"Go","readme":"# LRU\nAnother thread-safe LRU Cache implemented in GO.\n\n\n## Install\n```\n$ go get github.com/souravray/lru\n``` \n## Sample Usage \u0026 Documentation\n\n```go\npackage main\n\nimport (\n  \"github.com/souravray/lru\"\n  \"fmt\"\n)\n\nfunc main() {\n  c, err := lru.New(20)\n  if err != nil {\n    panic(err)\n  }\n  c.Add(\"Key1\", \"ok\")\n  value, ok := c.Fetch(\"Key1\")\n  if !ok {\n    panic(\"Cannot fetch value for Key1\")\n  }\n  fmt.Println(\"Key1:\", value)\n  for i:=2; i\u003c22; i++ {\n    c.Add(i, \"ok\")\n  }\n  if c.Exist(\"Key1\") {\n    panic(\"Key1: Stale key\")\n  } else {\n    fmt.Println(\"Key1: Evicted\")\n  }\n}\n```\n```\n  Key1: ok\n  Key1: Evicted\n```\n\nDocumentation is available on [Godoc](https://godoc.org/github.com/souravray/lru)\n\n\n## Unit Test\nUnit tests are avilable for list and base lru implementations. You can run unit test-cases by\n```\n$ go test -v -cover\n``` \nUnit test code coverage is 70.2%, and thread safe methods doesn't have separate unit test-cases. You can also check the [test-coverage](http://raysourav.com/lru/cover.html) report.\n\n\n## Benchmarking\nAt best-case scinarions the LRU perfoms 180 ns/op (on avarage). You can run the benchmark tests by\n```\ngo test -bench=. -benchtime=1s\n``` \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouravray%2Flru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsouravray%2Flru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouravray%2Flru/lists"}