{"id":28223749,"url":"https://github.com/nfangxu/ilocker","last_synced_at":"2025-07-16T23:34:01.817Z","repository":{"id":41894291,"uuid":"474921461","full_name":"nfangxu/ilocker","owner":"nfangxu","description":"Golang locker interface","archived":false,"fork":false,"pushed_at":"2022-04-24T04:05:29.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T00:41:00.121Z","etag":null,"topics":["go","golang","lock","locker","locking","locks"],"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/nfangxu.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":"2022-03-28T08:56:15.000Z","updated_at":"2022-04-24T06:35:49.000Z","dependencies_parsed_at":"2022-08-11T20:31:04.121Z","dependency_job_id":null,"html_url":"https://github.com/nfangxu/ilocker","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nfangxu/ilocker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfangxu%2Filocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfangxu%2Filocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfangxu%2Filocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfangxu%2Filocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfangxu","download_url":"https://codeload.github.com/nfangxu/ilocker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfangxu%2Filocker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265550357,"owners_count":23786550,"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":["go","golang","lock","locker","locking","locks"],"created_at":"2025-05-18T08:10:18.123Z","updated_at":"2025-07-16T23:34:01.812Z","avatar_url":"https://github.com/nfangxu.png","language":"Go","readme":"### Golang locker interface\n\n- Use the built-in memory locker\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"github.com/nfangxu/ilocker\"\n\t\"time\"\n)\n\nfunc main() {\n\tlocker := ilocker.NewMemoryLocker(time.Minute)\n\tld, err := locker.Lock(context.TODO(), \"foo\", time.Second)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer ld.UnLock(context.TODO())\n\t// TODO: do something\n}\n```\n\n- Custom locker\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"github.com/nfangxu/ilocker\"\n\t\"time\"\n)\n\ntype RedisLocker struct {\n}\n\nfunc (r *RedisLocker) Lock(ctx context.Context, id string, ttl time.Duration) (ilocker.ILocked, error) {\n\t// TODO: implement\n\treturn ilocker.Locked(r, id) // return a locked object\n}\n\nfunc (r *RedisLocker) Locking(ctx context.Context, id string) bool {\n\t// TODO: implement\n\treturn false\n}\n\nfunc (r *RedisLocker) UnLock(ctx context.Context, id string) error {\n\t// TODO: implement\n\treturn nil\n}\n\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfangxu%2Filocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfangxu%2Filocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfangxu%2Filocker/lists"}