{"id":42299264,"url":"https://github.com/montexristos/hashlock","last_synced_at":"2026-01-27T10:19:27.293Z","repository":{"id":57574487,"uuid":"353634366","full_name":"montexristos/hashlock","owner":"montexristos","description":"Golang library that allows locking resources for concurrent writes identified by a string","archived":false,"fork":false,"pushed_at":"2021-04-01T10:53:42.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T18:25:49.401Z","etag":null,"topics":["concurrency","golang-package","hashlock"],"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/montexristos.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-04-01T08:47:37.000Z","updated_at":"2021-04-01T10:53:27.000Z","dependencies_parsed_at":"2022-08-30T21:24:17.565Z","dependency_job_id":null,"html_url":"https://github.com/montexristos/hashlock","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/montexristos/hashlock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montexristos%2Fhashlock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montexristos%2Fhashlock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montexristos%2Fhashlock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montexristos%2Fhashlock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/montexristos","download_url":"https://codeload.github.com/montexristos/hashlock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montexristos%2Fhashlock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28811625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:41:26.337Z","status":"ssl_error","status_checked_at":"2026-01-27T07:41:08.776Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["concurrency","golang-package","hashlock"],"created_at":"2026-01-27T10:19:26.439Z","updated_at":"2026-01-27T10:19:27.288Z","avatar_url":"https://github.com/montexristos.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hashlock\n\n[![codecov](https://codecov.io/gh/montexristos/hashlock/branch/master/graph/badge.svg?token=6AU1RTYQZX)](https://codecov.io/gh/montexristos/hashlock)\n[![Go Reference](https://pkg.go.dev/badge/github.com/montexristos/hashlock.svg)](https://pkg.go.dev/github.com/montexristos/hashlock)\n\n## Description\n\nPackage hashlock provides a way to lock multiple string indexes and only allow write access to a resource to one thread at a time\n\nBattle-tested in multi-threaded applications with thousands concurrent writes and reads per minute\n\n## Background\n\nMost lock mechanisms in golang use sync.Mutex which works quite well most of the time.\n\nHowever, if someone tries to acquire an uninitialized Mutex, a non-recoverable error will occur. Checking if the Mutex is initialized may require complex custom logic\n\nThat is the reason this library uses boolean channels to handle locking which handle pretty well in terms of stability and performance\n\n## IMPORTANT NOTE\n\nThis library is not designed to be a queue, so do not expect a FIFO or any other behavior\n\nThe goal is to avoid multiple threads writing to the same resource, while keeping it available for concurrent reads\n\n## Usage\n\n    import \"github.com/montexristos/hashlock\"\n\n    hashLock := (\u0026HashLock{}).New(1 * time.Second)\n\n    // lock the value for read/write\n    hashLock.Lock(\"awesomeKey\")\n    defer hashLock.Unlock(\"awesomeKey\")\n    \n    //\n    go hashLock.Lock(\"awesomeKey\")\n\n    // the goroutine initiated above will wait for the current function to release the lock\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontexristos%2Fhashlock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmontexristos%2Fhashlock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontexristos%2Fhashlock/lists"}