Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 875 Bytes

README.md

File metadata and controls

40 lines (27 loc) · 875 Bytes

natspy-lock

PyPI - Version PyPI - Python Version


natspy-lock is a distributed lock library using nats.

Table of Contents

Installation

pip install natspy-lock

Example

import nats
from natspy_lock import NatsLock

async def main():
    nc = await nats.connect("nats://127.0.0.1:4222")
    await NatsLock.init(nc, "test_lock", 60)
    async with NatsLock.get_lock("test_lock", 1):
    #     do something
        pass
    await nc.drain()

License

natspy-lock is distributed under the terms of the MIT license.