Commit b2690ae5 authored by Marc Gravell's avatar Marc Gravell

Merge pull request #170 from kevin-montrose/named-script-parameters-squashed

Named script parameters squashed
parents f4208759 f0379da8
This diff is collapsed.
......@@ -74,6 +74,7 @@
<Compile Include="StackExchange\Redis\HashEntry.cs" />
<Compile Include="StackExchange\Redis\InternalErrorEventArgs.cs" />
<Compile Include="StackExchange\Redis\MigrateOptions.cs" />
<Compile Include="StackExchange\Redis\LuaScript.cs" />
<Compile Include="StackExchange\Redis\RedisChannel.cs" />
<Compile Include="StackExchange\Redis\Bitwise.cs" />
<Compile Include="StackExchange\Redis\ClientFlags.cs" />
......@@ -139,6 +140,7 @@
<Compile Include="StackExchange\Redis\ResultProcessor.cs" />
<Compile Include="StackExchange\Redis\RedisSubscriber.cs" />
<Compile Include="StackExchange\Redis\ResultType.cs" />
<Compile Include="StackExchange\Redis\ScriptParameterMapper.cs" />
<Compile Include="StackExchange\Redis\ServerCounters.cs" />
<Compile Include="StackExchange\Redis\ServerEndPoint.cs" />
<Compile Include="StackExchange\Redis\ServerSelectionStrategy.cs" />
......
......@@ -68,6 +68,7 @@
<Compile Include="StackExchange\Redis\HashEntry.cs" />
<Compile Include="StackExchange\Redis\InternalErrorEventArgs.cs" />
<Compile Include="StackExchange\Redis\MigrateOptions.cs" />
<Compile Include="StackExchange\Redis\LuaScript.cs" />
<Compile Include="StackExchange\Redis\RedisChannel.cs" />
<Compile Include="StackExchange\Redis\Bitwise.cs" />
<Compile Include="StackExchange\Redis\ClientFlags.cs" />
......@@ -133,6 +134,7 @@
<Compile Include="StackExchange\Redis\ResultProcessor.cs" />
<Compile Include="StackExchange\Redis\RedisSubscriber.cs" />
<Compile Include="StackExchange\Redis\ResultType.cs" />
<Compile Include="StackExchange\Redis\ScriptParameterMapper.cs" />
<Compile Include="StackExchange\Redis\ServerCounters.cs" />
<Compile Include="StackExchange\Redis\ServerEndPoint.cs" />
<Compile Include="StackExchange\Redis\ServerSelectionStrategy.cs" />
......
......@@ -1903,7 +1903,6 @@ public Task<long> PublishReconfigureAsync(CommandFlags flags = CommandFlags.None
if (channel == null) return CompletedTask<long>.Default(null);
return GetSubscriber().PublishAsync(channel, RedisLiterals.Wildcard, flags);
}
}
}
}
......@@ -452,6 +452,7 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// <returns>the number of clients that received the message.</returns>
/// <remarks>http://redis.io/commands/publish</remarks>
long Publish(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Execute a Lua script against the server
/// </summary>
......@@ -464,7 +465,20 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// </summary>
/// <remarks>http://redis.io/commands/evalsha</remarks>
/// <returns>A dynamic representation of the script's result</returns>
RedisResult ScriptEvaluate(byte[] hash, RedisKey[] keys = null, RedisValue[] values = null, CommandFlags flags = CommandFlags.None);
RedisResult ScriptEvaluate(byte[] hash, RedisKey[] keys = null, RedisValue[] values = null, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Execute a lua script against the server, using previously prepared script.
/// Named parameters, if any, are provided by the `parameters` object.
/// </summary>
RedisResult ScriptEvaluate(LuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Execute a lua script against the server, using previously prepared and loaded script.
/// This method sends only the SHA1 hash of the lua script to Redis.
/// Named parameters, if any, are provided by the `parameters` object.
/// </summary>
RedisResult ScriptEvaluate(LoadedLuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Add the specified member to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.
......
......@@ -437,7 +437,20 @@ public interface IDatabaseAsync : IRedisAsync
/// </summary>
/// <remarks>http://redis.io/commands/evalsha</remarks>
/// <returns>A dynamic representation of the script's result</returns>
Task<RedisResult> ScriptEvaluateAsync(byte[] hash, RedisKey[] keys = null, RedisValue[] values = null, CommandFlags flags = CommandFlags.None);
Task<RedisResult> ScriptEvaluateAsync(byte[] hash, RedisKey[] keys = null, RedisValue[] values = null, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Execute a lua script against the server, using previously prepared script.
/// Named parameters, if any, are provided by the `parameters` object.
/// </summary>
Task<RedisResult> ScriptEvaluateAsync(LuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Execute a lua script against the server, using previously prepared and loaded script.
/// This method sends only the SHA1 hash of the lua script to Redis.
/// Named parameters, if any, are provided by the `parameters` object.
/// </summary>
Task<RedisResult> ScriptEvaluateAsync(LoadedLuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Add the specified member to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.
......
......@@ -312,12 +312,22 @@ public partial interface IServer : IRedis
/// <summary>
/// Explicitly defines a script on the server
/// </summary>
byte[] ScriptLoad(string script, CommandFlags flags = CommandFlags.None);
byte[] ScriptLoad(string script, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Explicitly defines a script on the server
/// </summary>
LoadedLuaScript ScriptLoad(LuaScript script, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Explicitly defines a script on the server
/// </summary>
Task<byte[]> ScriptLoadAsync(string script, CommandFlags flags = CommandFlags.None);
Task<byte[]> ScriptLoadAsync(string script, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Explicitly defines a script on the server
/// </summary>
Task<LoadedLuaScript> ScriptLoadAsync(LuaScript script, CommandFlags flags = CommandFlags.None);
/// <summary>Asks the redis server to shutdown, killing all connections. Please FULLY read the notes on the SHUTDOWN command.</summary>
/// <remarks>http://redis.io/commands/shutdown</remarks>
......
......@@ -323,6 +323,18 @@ public RedisResult ScriptEvaluate(string script, RedisKey[] keys = null, RedisVa
return this.Inner.ScriptEvaluate(script, this.ToInner(keys), values, flags);
}
public RedisResult ScriptEvaluate(LuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None)
{
// TODO: The return value could contain prefixed keys. It might make sense to 'unprefix' those?
return script.Evaluate(this.Inner, parameters, Prefix, flags);
}
public RedisResult ScriptEvaluate(LoadedLuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None)
{
// TODO: The return value could contain prefixed keys. It might make sense to 'unprefix' those?
return script.Evaluate(this.Inner, parameters, Prefix, flags);
}
public long SetAdd(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None)
{
return this.Inner.SetAdd(this.ToInner(key), values, flags);
......
......@@ -334,6 +334,16 @@ public Task<RedisResult> ScriptEvaluateAsync(string script, RedisKey[] keys = nu
return this.Inner.ScriptEvaluateAsync(script, this.ToInner(keys), values, flags);
}
public Task<RedisResult> ScriptEvaluateAsync(LuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None)
{
throw new NotImplementedException();
}
public Task<RedisResult> ScriptEvaluateAsync(LoadedLuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None)
{
throw new NotImplementedException();
}
public Task<long> SetAddAsync(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None)
{
return this.Inner.SetAddAsync(this.ToInner(key), values, flags);
......
This diff is collapsed.
......@@ -373,6 +373,16 @@ public Task<byte[]> ScriptLoadAsync(string script, CommandFlags flags = CommandF
{
var msg = new RedisDatabase.ScriptLoadMessage(flags, script);
return ExecuteAsync(msg, ResultProcessor.ScriptLoad);
}
public LoadedLuaScript ScriptLoad(LuaScript script, CommandFlags flags = CommandFlags.None)
{
return script.Load(this, flags);
}
public Task<LoadedLuaScript> ScriptLoadAsync(LuaScript script, CommandFlags flags = CommandFlags.None)
{
return script.LoadAsync(this, flags);
}
public void Shutdown(ShutdownMode shutdownMode = ShutdownMode.Default, CommandFlags flags = CommandFlags.None)
......
......@@ -113,6 +113,7 @@
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\MessageCompletable.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\MessageQueue.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\MigrateOptions.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\LuaScript.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\Order.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\PhysicalBridge.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\PhysicalConnection.cs" />
......@@ -136,6 +137,7 @@
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ResultBox.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ResultProcessor.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ResultType.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ScriptParameterMapper.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\SaveType.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ServerCounters.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ServerEndPoint.cs" />
......
......@@ -107,6 +107,7 @@
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\MessageCompletable.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\MessageQueue.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\MigrateOptions.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\LuaScript.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\Order.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\PhysicalBridge.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\PhysicalConnection.cs" />
......@@ -130,6 +131,7 @@
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ResultBox.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ResultProcessor.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ResultType.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ScriptParameterMapper.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\SaveType.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ServerCounters.cs" />
<Compile Include="..\StackExchange.Redis\StackExchange\Redis\ServerEndPoint.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment