{"id":13411746,"url":"https://github.com/floatdrop/2q","last_synced_at":"2025-03-14T17:31:06.465Z","repository":{"id":42694592,"uuid":"474645637","full_name":"floatdrop/2q","owner":"floatdrop","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-24T10:47:47.000Z","size":15,"stargazers_count":42,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-14T01:31:40.875Z","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/floatdrop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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}},"created_at":"2022-03-27T13:27:26.000Z","updated_at":"2024-11-24T14:48:55.000Z","dependencies_parsed_at":"2024-06-19T05:16:06.224Z","dependency_job_id":"29f418ab-1240-4a22-a8f5-575323fe0a4d","html_url":"https://github.com/floatdrop/2q","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2F2q","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2F2q/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2F2q/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2F2q/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floatdrop","download_url":"https://codeload.github.com/floatdrop/2q/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243618659,"owners_count":20320273,"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-07-30T20:01:16.439Z","updated_at":"2025-03-14T17:31:06.145Z","avatar_url":"https://github.com/floatdrop.png","language":"Go","readme":"# 2q\n[![Go Reference](https://pkg.go.dev/badge/github.com/floatdrop/2q.svg)](https://pkg.go.dev/github.com/floatdrop/2q)\n[![CI](https://github.com/floatdrop/2q/actions/workflows/ci.yml/badge.svg)](https://github.com/floatdrop/2q/actions/workflows/ci.yml)\n![Coverage](https://img.shields.io/badge/Coverage-88.9%25-brightgreen)\n[![Go Report Card](https://goreportcard.com/badge/github.com/floatdrop/2q)](https://goreportcard.com/report/github.com/floatdrop/2q)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n\nThread safe GoLang [2Q](http://www.vldb.org/conf/1994/P439.PDF) cache.\n\n## Example\n\n```go\nimport (\n\t\"fmt\"\n\n\ttwoqueue \"github.com/floatdrop/2q\"\n)\n\nfunc main() {\n\tcache := twoqueue.New[string, int](256)\n\n\tcache.Set(\"Hello\", 5)\n\n\tif e := cache.Get(\"Hello\"); e != nil {\n\t\tfmt.Println(*e)\n\t\t// Output: 5\n\t}\n}\n```\n\n## TTL\n\nSee [LRU TTL example](https://github.com/floatdrop/lru#ttl).\n\n## Benchmarks\n\n```\nfloatdrop/twoqueue:\n\tBenchmark2Q_Rand-8   \t 4384994\t       264.5 ns/op\t      46 B/op\t       3 allocs/op\n\tBenchmark2Q_Freq-8   \t 4862632\t       243.9 ns/op\t      44 B/op\t       3 allocs/op\n\nhashicorp/golang-lru:\n\tBenchmark2Q_Rand-8    \t 2847627\t       411.9 ns/op\t     135 B/op\t       5 allocs/op\n\tBenchmark2Q_Freq-8    \t 3323764\t       354.2 ns/op\t     122 B/op\t       5 allocs/op\n```\n","funding_links":[],"categories":["Database","数据库","Generators","Data Integration Frameworks"],"sub_categories":["Caches","缓存"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2F2q","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloatdrop%2F2q","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2F2q/lists"}