forked from TheDeveloper/warlock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
2,609 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
env: | ||
commonjs: true | ||
es2021: true | ||
node: true | ||
extends: | ||
- airbnb-base | ||
parserOptions: | ||
ecmaVersion: 12 | ||
rules: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,7 @@ node_js: | |
- '0.12' | ||
- '0.10' | ||
- iojs | ||
- '4.2' | ||
- '5.3' | ||
services: | ||
- redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
redis: | ||
image: redis:3.2-alpine | ||
ports: | ||
- 6386:6379 | ||
container_name: warlock-redis | ||
|
||
monitor: | ||
image: redis:3.2-alpine | ||
links: | ||
- redis | ||
entrypoint: "/bin/sh" | ||
command: > | ||
"-c" "redis-cli -h warlock-redis -p 6379 monitor" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const path = require('path'); | ||
|
||
const _path = path.resolve(__dirname, './lua/parityDel.lua'); | ||
const src = require('fs').readFileSync(_path, { encoding: 'utf-8' }); | ||
const { createScript } = require('node-redis-script'); | ||
|
||
exports.createScript = (redis) => { | ||
const opts = { redis }; | ||
return createScript(opts, src); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- | ||
-- Extend the key if content is equal | ||
-- This will extend the lock on the | ||
-- | ||
-- KEYS[1] - key | ||
-- KEYS[2] - content | ||
-- KEYS[3] - lock id | ||
local key = KEYS[1] | ||
local ttl = KEYS[2] | ||
local id = KEYS[3] | ||
|
||
local value = redis.call('GET', key) | ||
|
||
if value == id then | ||
return redis.call('SET', key, id, 'PX', ttl, 'XX'); | ||
else | ||
return 0 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.