{"id":23129029,"url":"https://github.com/twiny/valve","last_synced_at":"2026-04-28T20:06:00.469Z","repository":{"id":57644858,"uuid":"437071926","full_name":"twiny/valve","owner":"twiny","description":"simple rate limiter API","archived":false,"fork":false,"pushed_at":"2021-12-21T14:23:40.000Z","size":2,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T17:42:30.509Z","etag":null,"topics":["golang","rate-limiter"],"latest_commit_sha":null,"homepage":"","language":"Go","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/twiny.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":"2021-12-10T18:08:11.000Z","updated_at":"2024-11-04T10:44:25.000Z","dependencies_parsed_at":"2022-09-08T14:31:49.604Z","dependency_job_id":null,"html_url":"https://github.com/twiny/valve","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twiny%2Fvalve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twiny%2Fvalve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twiny%2Fvalve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twiny%2Fvalve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twiny","download_url":"https://codeload.github.com/twiny/valve/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247130940,"owners_count":20888683,"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":["golang","rate-limiter"],"created_at":"2024-12-17T10:08:08.345Z","updated_at":"2026-04-28T20:06:00.416Z","avatar_url":"https://github.com/twiny.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Valve\nsimple key based rate limiter API using in-memory store.\n\n**NOTE**: This package is provided \"as is\" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please [create a new issue](https://github.com/twiny/valve/issues/new).\n\n## Install\n`go get github.com/twiny/valve`\n\n## API\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/twiny/valve\"\n)\n\nfunc main() {\n    // rate:    10 requests per second\n    // bursts:  5 permits bursts\n    // ttl:     reset every 10 minutes - if ttl less then 1 minutes, it will be set to 1 minute.\n\tlimiter := valve.NewLimiter(10, 5, 10*time.Minute)\n\tdefer limiter.Close()\n\tkey := \"127.0.0.1\" // some key\n\n\tfor i := 0; i \u003c 100; i++ {\n\t\tif !limiter.Allow(key) {\n\t\t\tfmt.Println(\"slow down\")\n\t\t}\n\t\tfmt.Println(\"passed\")\n\t}\n}\n// output:\n/*\npassed\npassed\npassed\npassed\npassed\nslow down\npassed\nslow down\npassed\nslow down\npassed\n...\n*/\n``` ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwiny%2Fvalve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwiny%2Fvalve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwiny%2Fvalve/lists"}