-
Notifications
You must be signed in to change notification settings - Fork 243
[DistributedLock.Redis] Bugfix: respect IDatabase key prefix #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7727168
b1c9b67
8a67440
1a7a81c
22fa50d
39dba9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,11 +20,13 @@ public RedisScript(string script, Func<TArgument, object> parameters) | |
| this._parameters = parameters; | ||
| } | ||
|
|
||
| public RedisResult Execute(IDatabase database, TArgument argument, bool fireAndForget = false) => | ||
| this._script.Evaluate(database, this._parameters(argument), flags: RedLockHelper.GetCommandFlags(fireAndForget)); | ||
| public RedisResult Execute(IDatabase database, TArgument argument, bool fireAndForget = false) => | ||
| // database.ScriptEvaluate must be called instead of _script.Evaluate in order to respect the database's key prefix | ||
| database.ScriptEvaluate(this._script, this._parameters(argument), flags: RedLockHelper.GetCommandFlags(fireAndForget)); | ||
|
|
||
| public Task<RedisResult> ExecuteAsync(IDatabaseAsync database, TArgument argument, bool fireAndForget = false) => | ||
| this._script.EvaluateAsync(database, this._parameters(argument), flags: RedLockHelper.GetCommandFlags(fireAndForget)); | ||
| public Task<RedisResult> ExecuteAsync(IDatabaseAsync database, TArgument argument, bool fireAndForget = false) => | ||
| // database.ScriptEvaluate must be called instead of _script.Evaluate in order to respect the database's key prefix | ||
| database.ScriptEvaluateAsync(this._script, this._parameters(argument), flags: RedLockHelper.GetCommandFlags(fireAndForget)); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow this change is super subtle. Is the idea that all other
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thats right, |
||
|
|
||
| // send the smallest possible script to the server | ||
| private static string RemoveExtraneousWhitespace(string script) => Regex.Replace(script.Trim(), @"\s+", " "); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.