redis-lock:Redis 使用 setnx 跨多个实例服务器分配锁

时间:2021-06-28 06:01:13
【文件属性】:
文件名称:redis-lock:Redis 使用 setnx 跨多个实例服务器分配锁
文件大小:5KB
文件格式:ZIP
更新时间:2021-06-28 06:01:13
JavaScript redis-lock Redis 使用跨多个实例/服务器分配锁 要求 - Redis 2.6.12 安装 npm install redis-locking 例子 var lock = require ( 'redis-locking' ) ( redis ) ; lock . acquire ( 'mykey' , { ttl : 500 } ) . then ( function ( ) { //do something } ) . then ( function ( ) { return lock . release ( 'mykey' ) ; } ) 应用程序接口 这两种方法都返回承诺。 获取(键,选项) Take the lock and avoid others to take it. `key` is a string key identifying th
【文件预览】:
redis-lock-master
----.travis.yml(294B)
----index.js(2KB)
----package.json(568B)
----test()
--------index.js(3KB)
----LICENSE(1KB)
----.npmignore(47B)
----.gitignore(535B)
----README.md(2KB)
----.jshintrc(718B)

网友评论