Node.js and Mutexes

后端 未结 4 906
情深已故
情深已故 2020-12-25 10:51

I\'m wondering if mutexes/locks are required for data access within Node.js. For example, lets say I\'ve created a simple server. The server provides a couple protocol metho

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-25 11:55

    I was looking for solution for node mutexes. Mutexes are sometimes necessary - you could be running multiple instances of your node application and may want to assure that only one of them is doing some particular thing. All solutions I could find were either not cross-process or depending on redis.

    So I made my own solution using file locks: https://github.com/Perennials/mutex-node

提交回复
热议问题