Commit ec289038 authored by Marc Gravell's avatar Marc Gravell

Switched to overload implementation to address breaking change issue

parent 88f65e42
......@@ -633,6 +633,13 @@ public interface IDatabase : IRedis, IDatabaseAsync
[IgnoreNamePrefix]
long SortAndStore(RedisKey destination, RedisKey key, long skip = 0, long take = -1, Order order = Order.Ascending, SortType sortType = SortType.Numeric, RedisValue by = default(RedisValue), RedisValue[] get = null, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Adds the specified member with the specified score to the sorted set stored at key. If the specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
/// </summary>
/// <returns>True if the value was added, False if it already existed (the score is still updated)</returns>
/// <remarks>http://redis.io/commands/zadd</remarks>
bool SortedSetAdd(RedisKey key, RedisValue member, double score, CommandFlags flags);
/// <summary>
/// Adds the specified member with the specified score to the sorted set stored at key. If the specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
/// </summary>
......@@ -640,6 +647,13 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// <remarks>http://redis.io/commands/zadd</remarks>
bool SortedSetAdd(RedisKey key, RedisValue member, double score, When when = When.Always, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Adds all the specified members with the specified scores to the sorted set stored at key. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
/// </summary>
/// <returns>The number of elements added to the sorted sets, not including elements already existing for which the score was updated.</returns>
/// <remarks>http://redis.io/commands/zadd</remarks>
long SortedSetAdd(RedisKey key, SortedSetEntry[] values, CommandFlags flags);
/// <summary>
/// Adds all the specified members with the specified scores to the sorted set stored at key. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
/// </summary>
......
......@@ -591,6 +591,13 @@ public interface IDatabaseAsync : IRedisAsync
[IgnoreNamePrefix]
Task<RedisValue[]> SortAsync(RedisKey key, long skip = 0, long take = -1, Order order = Order.Ascending, SortType sortType = SortType.Numeric, RedisValue by = default(RedisValue), RedisValue[] get = null, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Adds the specified member with the specified score to the sorted set stored at key. If the specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
/// </summary>
/// <returns>True if the value was added, False if it already existed (the score is still updated)</returns>
/// <remarks>http://redis.io/commands/zadd</remarks>
Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double score, CommandFlags flags);
/// <summary>
/// Adds the specified member with the specified score to the sorted set stored at key. If the specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
/// </summary>
......@@ -598,6 +605,13 @@ public interface IDatabaseAsync : IRedisAsync
/// <remarks>http://redis.io/commands/zadd</remarks>
Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double score, When when = When.Always, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Adds all the specified members with the specified scores to the sorted set stored at key. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
/// </summary>
/// <returns>The number of elements added to the sorted sets, not including elements already existing for which the score was updated.</returns>
/// <remarks>http://redis.io/commands/zadd</remarks>
Task<long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, CommandFlags flags);
/// <summary>
/// Adds all the specified members with the specified scores to the sorted set stored at key. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
/// </summary>
......
......@@ -415,12 +415,19 @@ public RedisValue[] Sort(RedisKey key, long skip = 0, long take = -1, Order orde
{
return Inner.Sort(ToInner(key), skip, take, order, sortType, SortByToInner(by), SortGetToInner(get), flags);
}
public long SortedSetAdd(RedisKey key, SortedSetEntry[] values, CommandFlags flags)
{
return Inner.SortedSetAdd(ToInner(key), values, flags);
}
public long SortedSetAdd(RedisKey key, SortedSetEntry[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)
{
return Inner.SortedSetAdd(ToInner(key), values, when, flags);
}
public bool SortedSetAdd(RedisKey key, RedisValue member, double score, CommandFlags flags)
{
return Inner.SortedSetAdd(ToInner(key), member, score, flags);
}
public bool SortedSetAdd(RedisKey key, RedisValue member, double score, When when = When.Always, CommandFlags flags = CommandFlags.None)
{
return Inner.SortedSetAdd(ToInner(key), member, score, when, flags);
......
......@@ -416,11 +416,19 @@ public Task<RedisValue[]> SortAsync(RedisKey key, long skip = 0, long take = -1,
return Inner.SortAsync(ToInner(key), skip, take, order, sortType, SortByToInner(by), SortGetToInner(get), flags);
}
public Task<long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, CommandFlags flags)
{
return Inner.SortedSetAddAsync(ToInner(key), values, flags);
}
public Task<long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)
{
return Inner.SortedSetAddAsync(ToInner(key), values, when, flags);
}
public Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double score, CommandFlags flags)
{
return Inner.SortedSetAddAsync(ToInner(key), member, score, flags);
}
public Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double score, When when = When.Always, CommandFlags flags = CommandFlags.None)
{
return Inner.SortedSetAddAsync(ToInner(key), member, score, when, flags);
......
......@@ -1145,25 +1145,42 @@ public Task<RedisValue[]> SortAsync(RedisKey key, long skip = 0, long take = -1,
var msg = GetSortedSetAddMessage(default(RedisKey), key, skip, take, order, sortType, by, get, flags);
return ExecuteAsync(msg, ResultProcessor.RedisValueArray);
}
public bool SortedSetAdd(RedisKey key, RedisValue member, double score, CommandFlags flags)
{
var msg = GetSortedSetAddMessage(key, member, score, When.Always, flags);
return ExecuteSync(msg, ResultProcessor.Boolean);
}
public bool SortedSetAdd(RedisKey key, RedisValue member, double score, When when = When.Always, CommandFlags flags = CommandFlags.None)
{
var msg = GetSortedSetAddMessage(key, member, score, when, flags);
return ExecuteSync(msg, ResultProcessor.Boolean);
}
public long SortedSetAdd(RedisKey key, SortedSetEntry[] values, CommandFlags flags)
{
var msg = GetSortedSetAddMessage(key, values, When.Always, flags);
return ExecuteSync(msg, ResultProcessor.Int64);
}
public long SortedSetAdd(RedisKey key, SortedSetEntry[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)
{
var msg = GetSortedSetAddMessage(key, values, when, flags);
return ExecuteSync(msg, ResultProcessor.Int64);
}
public Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double score, CommandFlags flags)
{
var msg = GetSortedSetAddMessage(key, member, score, When.Always, flags);
return ExecuteAsync(msg, ResultProcessor.Boolean);
}
public Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double score, When when = When.Always, CommandFlags flags = CommandFlags.None)
{
var msg = GetSortedSetAddMessage(key, member, score, when, flags);
return ExecuteAsync(msg, ResultProcessor.Boolean);
}
public Task<long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, CommandFlags flags)
{
var msg = GetSortedSetAddMessage(key, values, When.Always, flags);
return ExecuteAsync(msg, ResultProcessor.Int64);
}
public Task<long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)
{
var msg = GetSortedSetAddMessage(key, values, when, flags);
......
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