Commit 5ec10092 authored by Marc Gravell's avatar Marc Gravell

Minor API break: the longer RandomKey sits there, the longer it gnaws at my...

Minor API break: the longer RandomKey sits there, the longer it gnaws at my soul as an odd exception to the naming rules; best to fix now
parent a6f4ada5
......@@ -28,7 +28,7 @@ or
Likewise, there are operations that *return* keys as `RedisKey` - and again, it simply works:
string someKey = db.RandomKey();
string someKey = db.KeyRandom();
Values
---
......
......@@ -35,11 +35,11 @@ public void RandomKey()
{
var db = conn.GetDatabase();
conn.GetServer(PrimaryServer, PrimaryPort).FlushDatabase();
string anyKey = db.RandomKey();
string anyKey = db.KeyRandom();
Assert.IsNull(anyKey);
db.StringSet("abc", "def");
byte[] keyBytes = db.RandomKey();
byte[] keyBytes = db.KeyRandom();
Assert.AreEqual("abc", Encoding.UTF8.GetString(keyBytes));
}
......
......@@ -71,8 +71,8 @@ public void CheckDatabaseMethodsUseKeys(Type type)
switch(method.Name)
{
case "RandomKey":
case "RandomKeyAsync":
case "KeyRandom":
case "KeyRandomAsync":
continue; // they're fine, but don't want to widen check to return type
}
......
......@@ -382,8 +382,7 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// </summary>
/// <returns>the random key, or nil when the database is empty.</returns>
/// <remarks>http://redis.io/commands/randomkey</remarks>
[IgnoreNamePrefix]
RedisKey RandomKey(CommandFlags flags = CommandFlags.None);
RedisKey KeyRandom(CommandFlags flags = CommandFlags.None);
/// <summary>
/// Execute a Lua script against the server
......
......@@ -368,8 +368,7 @@ public interface IDatabaseAsync : IRedisAsync
/// </summary>
/// <returns>the random key, or nil when the database is empty.</returns>
/// <remarks>http://redis.io/commands/randomkey</remarks>
[IgnoreNamePrefix]
Task<RedisKey> RandomKeyAsync(CommandFlags flags = CommandFlags.None);
Task<RedisKey> KeyRandomAsync(CommandFlags flags = CommandFlags.None);
......
......@@ -661,13 +661,13 @@ public Task<bool> LockTakeAsync(RedisKey key, RedisValue value, TimeSpan expiry,
return StringSetAsync(key, value, expiry, When.NotExists, flags);
}
public RedisKey RandomKey(CommandFlags flags = CommandFlags.None)
public RedisKey KeyRandom(CommandFlags flags = CommandFlags.None)
{
var msg = Message.Create(Db, flags, RedisCommand.RANDOMKEY);
return ExecuteSync(msg, ResultProcessor.RedisKey);
}
public Task<RedisKey> RandomKeyAsync(CommandFlags flags = CommandFlags.None)
public Task<RedisKey> KeyRandomAsync(CommandFlags flags = CommandFlags.None)
{
var msg = Message.Create(Db, flags, RedisCommand.RANDOMKEY);
return ExecuteAsync(msg, ResultProcessor.RedisKey);
......
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