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
1 parent
0159a36
commit cad91b9
Showing
4 changed files
with
27 additions
and
21 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,20 @@ | ||
local curr_val = redis.call('get', _:k); | ||
|
||
if (_:old-val-?sha ~= '') then | ||
-- Check current value's SHA1 | ||
local curr_sha = redis.sha1hex(curr_val); | ||
if (curr_sha == _:old-val-?sha) then | ||
redis.call('set', _:k, _:new-val); | ||
return true; -- 1 | ||
else | ||
return false; -- nil (was 0) | ||
end | ||
else | ||
-- Check current value | ||
if (curr_val == _:old-?val) then | ||
redis.call('set', _:k, _:new-val); | ||
return true; -- 1 | ||
else | ||
return false; -- nil (was 0) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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