Socket
Socket
Sign inDemoInstall

node-redis-warlock

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-redis-warlock - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

8

lib/warlock.js

@@ -12,3 +12,3 @@ var crypto = require('crypto');

warlock.makeKey = function(key) {
return 'lock:' + crypto.createHash('md5').update(key).digest('hex').substr(0, 10)
return 'lock:' + crypto.createHash('md5').update(key).digest('hex').substr(0, 10);
};

@@ -25,5 +25,7 @@

if (typeof key !== 'string') return cb('lock key must be string');
if (typeof key !== 'string') return cb(new Error('lock key must be string'));
scripty.loadScriptFile('lock', __dirname + '/lua/lock.lua', function(err, lock){
if (err) return cb(err);
var timestamp = Date.now();

@@ -47,3 +49,3 @@ lock.run(3, warlock.makeKey(key), ttl, timestamp, function(err, lockSet) {

if (typeof key !== 'string') return cb('lock key must be string');
if (typeof key !== 'string') return cb(new Error('lock key must be string'));

@@ -50,0 +52,0 @@ scripty.loadScriptFile('parityDel', __dirname + '/lua/parityDel.lua', function(err, parityDel){

{
"name": "node-redis-warlock",
"version": "0.0.6",
"version": "0.0.7",
"description": "Battle-hardened distributed locking using redis",

@@ -25,3 +25,3 @@ "main": "lib/warlock.js",

"dependencies": {
"node-redis-scripty": "0.0.3"
"node-redis-scripty": "~0.0.4"
},

@@ -28,0 +28,0 @@ "devDependencies": {

@@ -6,2 +6,11 @@ warlock

## Requirements
* [node-redis](https://github.com/mranney/node_redis) compatible with `v0.10`
* Redis `v2.6` or above
## Install
npm install node-redis-warlock
## Usage

@@ -42,1 +51,6 @@

```
## ProTips
* Warlock uses Lua scripting to achieve transactional locking on Redis `v2.6.0` upwards. If you're running Redis `v2.6.12` or above you could use the additional PX and NX arguments for the [SET](http://redis.io/commands/set) operation as an alternative.
* Read my [Distributed locks using Redis](https://engineering.gosquared.com/distributed-locks-using-redis) article and Redis' author's [A proposal for more reliable locks using Redis](http://antirez.com/news/77) to learn more about the theory of distributed locks using Redis.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc