{"repo":"e-chip/redis-rwlock","free":true,"listed":false,"github":"https://github.com/e-chip/redis-rwlock","clone":"git clone https://github.com/e-chip/redis-rwlock.git","description":"Golang implementation of distributed RW-Lock (Writer-preferring) using Redis.","language":"Go","stars":21,"topics":["golang","redis","rwlock","distributed-lock","hacktoberfest"],"license":"MIT","category":"databases-storage","readme_excerpt":"redis-rwlock Distributed RW-lock for Go backed by Redis. Readers share the lock; a writer acquires it exclusively. All lock operations are single atomic Lua scripts. Automatic TTL refresh keeps the lock alive for the duration of the protected function. Requirements - Redis 3.2+ — required for redis.replicate commands() , which enables script-effects replication. Without it, Redis replays the entire EVAL call on AOF recovery and re-executes scripts with relative TTLs reset to current time. - Redis 7.0+ — script-effects replication is automatic; no extra configuration needed. - Redis Cluster — both keys derived from the prefix ( prefix:lock , prefix:counter ) must land in the same hash slot. Use a hash tag in the prefix: \"{myapp:resource}\" . Installation Pick an adapter for your Redis client: Usage Custom Redis client Implement the single-method RedisClient interface to integrate any Redis client: Options Option Default Minimum Description ----------------- ---------------------------------------- ------- ---------------------------------------------------------------------------------------------------------------------------- LockTTL 1 s 100 ms Lock expiry. Refreshed every LockTTL/2 while held. Keep below RetryCount × RetryInterval to avoid spurious ErrTimeout . RetryCount 200 1 Acquisition attempts before returning ErrTimeout . RetryInterval 10 ms 1 ms Pause between acquisition attempts. AppID \"\" — Prefix added to the writer token. Useful for identifying which process holds ","default_branch":null,"files":null,"tree":[],"storefront":"/r/e-chip","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/e-chip/redis-rwlock/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}