Commit e91662e2 authored by Nick Craver's avatar Nick Craver

Tests: tons of performance work.

This is mainly around proper FireAndForget as well as .Wait() elimination. More to do but this is a big first pass.
parent 64df91da
...@@ -17,7 +17,7 @@ public void TestAdhocCommandsAPI() ...@@ -17,7 +17,7 @@ public void TestAdhocCommandsAPI()
// needs explicit RedisKey type for key-based // needs explicit RedisKey type for key-based
// sharding to work; will still work with strings, // sharding to work; will still work with strings,
// but no key-based sharding support // but no key-based sharding support
RedisKey key = "some_key"; RedisKey key = Me();
// note: if command renames are configured in // note: if command renames are configured in
// the API, they will still work automatically // the API, they will still work automatically
......
...@@ -13,14 +13,13 @@ public class BasicOpsTests : TestBase ...@@ -13,14 +13,13 @@ public class BasicOpsTests : TestBase
public BasicOpsTests(ITestOutputHelper output) : base (output) { } public BasicOpsTests(ITestOutputHelper output) : base (output) { }
[Fact] [Fact]
public void PingOnce() public async Task PingOnce()
{ {
using (var muxer = Create()) using (var muxer = Create())
{ {
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
var task = conn.PingAsync(); var duration = await conn.PingAsync().ForAwait();
var duration = muxer.Wait(task);
Log("Ping took: " + duration); Log("Ping took: " + duration);
Assert.True(duration.TotalMilliseconds > 0); Assert.True(duration.TotalMilliseconds > 0);
} }
...@@ -33,7 +32,7 @@ public void RapidDispose() ...@@ -33,7 +32,7 @@ public void RapidDispose()
using (var primary = Create()) using (var primary = Create())
{ {
var conn = primary.GetDatabase(); var conn = primary.GetDatabase();
conn.KeyDelete(key); conn.KeyDelete(key, CommandFlags.FireAndForget);
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
...@@ -47,18 +46,17 @@ public void RapidDispose() ...@@ -47,18 +46,17 @@ public void RapidDispose()
} }
[Fact] [Fact]
public void PingMany() public async Task PingMany()
{ {
using (var muxer = Create()) using (var muxer = Create())
{ {
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
var tasks = new Task<TimeSpan>[100]; var tasks = new Task<TimeSpan>[100];
for (int i = 0; i < tasks.Length; i++) for (int i = 0; i < tasks.Length; i++)
{ {
tasks[i] = conn.PingAsync(); tasks[i] = conn.PingAsync();
} }
muxer.WaitAll(tasks); await Task.WhenAll(tasks).ForAwait();
Assert.True(tasks[0].Result.TotalMilliseconds > 0); Assert.True(tasks[0].Result.TotalMilliseconds > 0);
Assert.True(tasks[tasks.Length - 1].Result.TotalMilliseconds > 0); Assert.True(tasks[tasks.Length - 1].Result.TotalMilliseconds > 0);
} }
...@@ -99,7 +97,7 @@ public void SetWithNullValue() ...@@ -99,7 +97,7 @@ public void SetWithNullValue()
db.StringSet(key, "abc", flags: CommandFlags.FireAndForget); db.StringSet(key, "abc", flags: CommandFlags.FireAndForget);
Assert.True(db.KeyExists(key)); Assert.True(db.KeyExists(key));
db.StringSet(key, value); db.StringSet(key, value, flags: CommandFlags.FireAndForget);
var actual = (string)db.StringGet(key); var actual = (string)db.StringGet(key);
Assert.Null(actual); Assert.Null(actual);
...@@ -119,7 +117,7 @@ public void SetWithDefaultValue() ...@@ -119,7 +117,7 @@ public void SetWithDefaultValue()
db.StringSet(key, "abc", flags: CommandFlags.FireAndForget); db.StringSet(key, "abc", flags: CommandFlags.FireAndForget);
Assert.True(db.KeyExists(key)); Assert.True(db.KeyExists(key));
db.StringSet(key, value); db.StringSet(key, value, flags: CommandFlags.FireAndForget);
var actual = (string)db.StringGet(key); var actual = (string)db.StringGet(key);
Assert.Null(actual); Assert.Null(actual);
...@@ -139,7 +137,7 @@ public void SetWithZeroValue() ...@@ -139,7 +137,7 @@ public void SetWithZeroValue()
db.StringSet(key, "abc", flags: CommandFlags.FireAndForget); db.StringSet(key, "abc", flags: CommandFlags.FireAndForget);
Assert.True(db.KeyExists(key)); Assert.True(db.KeyExists(key));
db.StringSet(key, value); db.StringSet(key, value, flags: CommandFlags.FireAndForget);
var actual = (string)db.StringGet(key); var actual = (string)db.StringGet(key);
Assert.Equal("0", actual); Assert.Equal("0", actual);
...@@ -182,10 +180,10 @@ public void GetSetSync() ...@@ -182,10 +180,10 @@ public void GetSetSync()
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
conn.KeyDelete(key); conn.KeyDelete(key, CommandFlags.FireAndForget);
var d1 = conn.KeyDelete(key); var d1 = conn.KeyDelete(key);
var g1 = conn.StringGet(key); var g1 = conn.StringGet(key);
conn.StringSet(key, "123"); conn.StringSet(key, "123", flags: CommandFlags.FireAndForget);
var g2 = conn.StringGet(key); var g2 = conn.StringGet(key);
var d2 = conn.KeyDelete(key); var d2 = conn.KeyDelete(key);
...@@ -204,23 +202,23 @@ public void GetSetSync() ...@@ -204,23 +202,23 @@ public void GetSetSync()
[InlineData(false, false)] [InlineData(false, false)]
[InlineData(true, true)] [InlineData(true, true)]
[InlineData(true, false)] [InlineData(true, false)]
public void GetWithExpiry(bool exists, bool hasExpiry) public async Task GetWithExpiry(bool exists, bool hasExpiry)
{ {
using (var conn = Create()) using (var conn = Create())
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
if (exists) if (exists)
{ {
if (hasExpiry) if (hasExpiry)
db.StringSet(key, "val", TimeSpan.FromMinutes(5)); db.StringSet(key, "val", TimeSpan.FromMinutes(5), flags: CommandFlags.FireAndForget);
else else
db.StringSet(key, "val"); db.StringSet(key, "val", flags: CommandFlags.FireAndForget);
} }
var async = db.StringGetWithExpiryAsync(key); var async = db.StringGetWithExpiryAsync(key);
var syncResult = db.StringGetWithExpiry(key); var syncResult = db.StringGetWithExpiry(key);
var asyncResult = db.Wait(async); var asyncResult = await async;
if (exists) if (exists)
{ {
...@@ -248,8 +246,8 @@ public async Task GetWithExpiryWrongTypeAsync() ...@@ -248,8 +246,8 @@ public async Task GetWithExpiryWrongTypeAsync()
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); var del = db.KeyDeleteAsync(key);
db.SetAdd(key, "abc"); var add = db.SetAddAsync(key, "abc");
var ex = await Assert.ThrowsAsync<RedisServerException>(async () => var ex = await Assert.ThrowsAsync<RedisServerException>(async () =>
{ {
try try
...@@ -269,14 +267,14 @@ public async Task GetWithExpiryWrongTypeAsync() ...@@ -269,14 +267,14 @@ public async Task GetWithExpiryWrongTypeAsync()
[Fact] [Fact]
public void GetWithExpiryWrongTypeSync() public void GetWithExpiryWrongTypeSync()
{ {
RedisKey key = Me();
var ex = Assert.Throws<RedisServerException>(() => var ex = Assert.Throws<RedisServerException>(() =>
{ {
using (var conn = Create()) using (var conn = Create())
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); db.KeyDelete(key, CommandFlags.FireAndForget);
db.KeyDelete(key); db.SetAdd(key, "abc", CommandFlags.FireAndForget);
db.SetAdd(key, "abc");
db.StringGetWithExpiry(key); db.StringGetWithExpiry(key);
} }
}); });
...@@ -431,15 +429,16 @@ private void Incr(IDatabase database, RedisKey key, int delta, ref int total) ...@@ -431,15 +429,16 @@ private void Incr(IDatabase database, RedisKey key, int delta, ref int total)
[Fact] [Fact]
public void WrappedDatabasePrefixIntegration() public void WrappedDatabasePrefixIntegration()
{ {
var key = Me();
using (var conn = Create()) using (var conn = Create())
{ {
var db = conn.GetDatabase().WithKeyPrefix("abc"); var db = conn.GetDatabase().WithKeyPrefix("abc");
db.KeyDelete("count"); db.KeyDelete(key, CommandFlags.FireAndForget);
db.StringIncrement("count"); db.StringIncrement(key, flags: CommandFlags.FireAndForget);
db.StringIncrement("count"); db.StringIncrement(key, flags: CommandFlags.FireAndForget);
db.StringIncrement("count"); db.StringIncrement(key, flags: CommandFlags.FireAndForget);
int count = (int)conn.GetDatabase().StringGet("abccount"); int count = (int)conn.GetDatabase().StringGet("abc" + key);
Assert.Equal(3, count); Assert.Equal(3, count);
} }
} }
......
...@@ -22,4 +22,4 @@ public void BasicOps() ...@@ -22,4 +22,4 @@ public void BasicOps()
} }
} }
} }
} }
\ No newline at end of file
...@@ -36,7 +36,7 @@ public void ExportConfiguration() ...@@ -36,7 +36,7 @@ public void ExportConfiguration()
} }
[Fact] [Fact]
public async Task ConnectUsesSingleSocket() public void ConnectUsesSingleSocket()
{ {
using (var sw = new StringWriter()) using (var sw = new StringWriter())
{ {
...@@ -46,7 +46,6 @@ public async Task ConnectUsesSingleSocket() ...@@ -46,7 +46,6 @@ public async Task ConnectUsesSingleSocket()
{ {
using (var muxer = Create(failMessage: i + ": ", log: sw)) using (var muxer = Create(failMessage: i + ": ", log: sw))
{ {
await Task.Delay(500).ForAwait();
foreach (var ep in muxer.GetEndPoints()) foreach (var ep in muxer.GetEndPoints())
{ {
var srv = muxer.GetServer(ep); var srv = muxer.GetServer(ep);
...@@ -174,8 +173,8 @@ string StringGet(IServer server, RedisKey key, CommandFlags flags = CommandFlags ...@@ -174,8 +173,8 @@ string StringGet(IServer server, RedisKey key, CommandFlags flags = CommandFlags
var key = Me(); var key = Me();
const string value = "abc"; const string value = "abc";
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.StringSet(key, value); db.StringSet(key, value, flags: CommandFlags.FireAndForget);
servers.First().Ping(); servers.First().Ping();
var config = servers.First().ClusterConfiguration; var config = servers.First().ClusterConfiguration;
Assert.NotNull(config); Assert.NotNull(config);
...@@ -445,12 +444,12 @@ public void SScan() ...@@ -445,12 +444,12 @@ public void SScan()
{ {
RedisKey key = "a"; RedisKey key = "a";
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
int totalUnfiltered = 0, totalFiltered = 0; int totalUnfiltered = 0, totalFiltered = 0;
for (int i = 0; i < 1000; i++) for (int i = 0; i < 1000; i++)
{ {
db.SetAdd(key, i); db.SetAdd(key, i, CommandFlags.FireAndForget);
totalUnfiltered += i; totalUnfiltered += i;
if (i.ToString().Contains("3")) totalFiltered += i; if (i.ToString().Contains("3")) totalFiltered += i;
} }
...@@ -502,7 +501,6 @@ public void AccessRandomKeys() ...@@ -502,7 +501,6 @@ public void AccessRandomKeys()
}; };
var pairs = new Dictionary<string, string>(); var pairs = new Dictionary<string, string>();
const int COUNT = 500; const int COUNT = 500;
Task[] send = new Task[COUNT];
int index = 0; int index = 0;
var servers = conn.GetEndPoints().Select(x => conn.GetServer(x)); var servers = conn.GetEndPoints().Select(x => conn.GetServer(x));
...@@ -520,9 +518,8 @@ public void AccessRandomKeys() ...@@ -520,9 +518,8 @@ public void AccessRandomKeys()
var key = Guid.NewGuid().ToString(); var key = Guid.NewGuid().ToString();
var value = Guid.NewGuid().ToString(); var value = Guid.NewGuid().ToString();
pairs.Add(key, value); pairs.Add(key, value);
send[index++] = cluster.StringSetAsync(key, value); cluster.StringSet(key, value, flags: CommandFlags.FireAndForget);
} }
conn.WaitAll(send);
var expected = new string[COUNT]; var expected = new string[COUNT];
var actual = new Task<RedisValue>[COUNT]; var actual = new Task<RedisValue>[COUNT];
...@@ -597,7 +594,7 @@ public void SimpleProfiling() ...@@ -597,7 +594,7 @@ public void SimpleProfiling()
var profiler = new TestProfiler(); var profiler = new TestProfiler();
var key = Me(); var key = Me();
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
conn.RegisterProfiler(profiler); conn.RegisterProfiler(profiler);
conn.BeginProfiling(profiler.MyContext); conn.BeginProfiling(profiler.MyContext);
......
...@@ -17,32 +17,30 @@ public void ValueEquals() ...@@ -17,32 +17,30 @@ public void ValueEquals()
} }
[Fact] [Fact]
public void TestManualIncr() public async Task TestManualIncr()
{ {
using (var muxer = Create(syncTimeout: 120000)) // big timeout while debugging using (var muxer = Create(syncTimeout: 120000)) // big timeout while debugging
{ {
var key = Me(); var key = Me();
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
for (int i = 0; i < 200; i++) for (int i = 0; i < 10; i++)
{ {
conn.KeyDelete(key); conn.KeyDelete(key, CommandFlags.FireAndForget);
Assert.Equal(1, conn.Wait(ManualIncr(conn, key))); Assert.Equal(1, await ManualIncrAsync(conn, key));
Assert.Equal(2, conn.Wait(ManualIncr(conn, key))); Assert.Equal(2, await ManualIncrAsync(conn, key));
Assert.Equal(2, (long)conn.StringGet(key)); Assert.Equal(2, (long)conn.StringGet(key));
} }
} }
} }
public async Task<long?> ManualIncr(IDatabase connection, RedisKey key) public async Task<long?> ManualIncrAsync(IDatabase connection, RedisKey key)
{ {
var oldVal = (long?)await connection.StringGetAsync(key).ForAwait(); var oldVal = (long?)await connection.StringGetAsync(key).ForAwait();
var newVal = (oldVal ?? 0) + 1; var newVal = (oldVal ?? 0) + 1;
var tran = connection.CreateTransaction(); var tran = connection.CreateTransaction();
{ // check hasn't changed { // check hasn't changed
#pragma warning disable 4014
tran.AddCondition(Condition.StringEqual(key, oldVal)); tran.AddCondition(Condition.StringEqual(key, oldVal));
tran.StringSetAsync(key, newVal); var t = tran.StringSetAsync(key, newVal);
#pragma warning restore 4014
if (!await tran.ExecuteAsync().ForAwait()) return null; // aborted if (!await tran.ExecuteAsync().ForAwait()) return null; // aborted
return newVal; return newVal;
} }
......
...@@ -26,11 +26,11 @@ public async Task CountKeys() ...@@ -26,11 +26,11 @@ public async Task CountKeys()
Skip.IfMissingDatabase(muxer, db1Id); Skip.IfMissingDatabase(muxer, db1Id);
Skip.IfMissingDatabase(muxer, db2Id); Skip.IfMissingDatabase(muxer, db2Id);
RedisKey key = Me(); RedisKey key = Me();
var db61 = muxer.GetDatabase(db1Id); var dba = muxer.GetDatabase(db1Id);
var db62 = muxer.GetDatabase(db2Id); var dbb = muxer.GetDatabase(db2Id);
db61.StringSet("abc", "def", flags: CommandFlags.FireAndForget); dba.StringSet("abc", "def", flags: CommandFlags.FireAndForget);
db61.StringIncrement(key, flags: CommandFlags.FireAndForget); dba.StringIncrement(key, flags: CommandFlags.FireAndForget);
db62.StringIncrement(key, flags: CommandFlags.FireAndForget); dbb.StringIncrement(key, flags: CommandFlags.FireAndForget);
var server = GetAnyMaster(muxer); var server = GetAnyMaster(muxer);
var c0 = server.DatabaseSizeAsync(db1Id); var c0 = server.DatabaseSizeAsync(db1Id);
...@@ -56,7 +56,7 @@ public void DatabaseCount() ...@@ -56,7 +56,7 @@ public void DatabaseCount()
} }
[Fact] [Fact]
public void MultiDatabases() public async Task MultiDatabases()
{ {
using (var muxer = Create()) using (var muxer = Create())
{ {
...@@ -64,26 +64,22 @@ public void MultiDatabases() ...@@ -64,26 +64,22 @@ public void MultiDatabases()
var db0 = muxer.GetDatabase(TestConfig.GetDedicatedDB(muxer)); var db0 = muxer.GetDatabase(TestConfig.GetDedicatedDB(muxer));
var db1 = muxer.GetDatabase(TestConfig.GetDedicatedDB(muxer)); var db1 = muxer.GetDatabase(TestConfig.GetDedicatedDB(muxer));
var db2 = muxer.GetDatabase(TestConfig.GetDedicatedDB(muxer)); var db2 = muxer.GetDatabase(TestConfig.GetDedicatedDB(muxer));
db0.Ping();
db0.KeyDelete(key, CommandFlags.FireAndForget); db0.KeyDelete(key, CommandFlags.FireAndForget);
db1.KeyDelete(key, CommandFlags.FireAndForget); db1.KeyDelete(key, CommandFlags.FireAndForget);
db2.KeyDelete(key, CommandFlags.FireAndForget); db2.KeyDelete(key, CommandFlags.FireAndForget);
muxer.WaitAll( db0.StringSet(key, "a", flags: CommandFlags.FireAndForget);
db0.StringSetAsync(key, "a"), db1.StringSet(key, "b", flags: CommandFlags.FireAndForget);
db1.StringSetAsync(key, "b"), db2.StringSet(key, "c", flags: CommandFlags.FireAndForget);
db2.StringSetAsync(key, "c")
);
var a = db0.StringGetAsync(key); var a = db0.StringGetAsync(key);
var b = db1.StringGetAsync(key); var b = db1.StringGetAsync(key);
var c = db2.StringGetAsync(key); var c = db2.StringGetAsync(key);
muxer.WaitAll(a, b, c);
Assert.Equal("a", muxer.Wait(a)); // db:0 Assert.Equal("a", await a); // db:0
Assert.Equal("b", muxer.Wait(b)); // db:1 Assert.Equal("b", await b); // db:1
Assert.Equal("c", muxer.Wait(c)); // db:2 Assert.Equal("c", await c); // db:2
} }
} }
} }
......
using System; using System;
using System.Threading.Tasks;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
...@@ -13,7 +14,7 @@ public class Expiry : TestBase ...@@ -13,7 +14,7 @@ public class Expiry : TestBase
[Theory] [Theory]
[InlineData(true)] [InlineData(true)]
[InlineData(false)] [InlineData(false)]
public void TestBasicExpiryTimeSpan(bool disablePTimes) public async Task TestBasicExpiryTimeSpan(bool disablePTimes)
{ {
using (var muxer = Create(disabledCommands: GetMap(disablePTimes))) using (var muxer = Create(disabledCommands: GetMap(disablePTimes)))
{ {
...@@ -32,15 +33,15 @@ public void TestBasicExpiryTimeSpan(bool disablePTimes) ...@@ -32,15 +33,15 @@ public void TestBasicExpiryTimeSpan(bool disablePTimes)
conn.KeyExpire(key, TimeSpan.MaxValue, CommandFlags.FireAndForget); conn.KeyExpire(key, TimeSpan.MaxValue, CommandFlags.FireAndForget);
var e = conn.KeyTimeToLiveAsync(key); var e = conn.KeyTimeToLiveAsync(key);
Assert.Null(muxer.Wait(a)); Assert.Null(await a);
var time = muxer.Wait(b); var time = await b;
Assert.NotNull(time); Assert.NotNull(time);
Assert.True(time > TimeSpan.FromMinutes(59.9) && time <= TimeSpan.FromMinutes(60)); Assert.True(time > TimeSpan.FromMinutes(59.9) && time <= TimeSpan.FromMinutes(60));
Assert.Null(muxer.Wait(c)); Assert.Null(await c);
time = muxer.Wait(d); time = await d;
Assert.NotNull(time); Assert.NotNull(time);
Assert.True(time > TimeSpan.FromMinutes(89.9) && time <= TimeSpan.FromMinutes(90)); Assert.True(time > TimeSpan.FromMinutes(89.9) && time <= TimeSpan.FromMinutes(90));
Assert.Null(muxer.Wait(e)); Assert.Null(await e);
} }
} }
...@@ -49,7 +50,7 @@ public void TestBasicExpiryTimeSpan(bool disablePTimes) ...@@ -49,7 +50,7 @@ public void TestBasicExpiryTimeSpan(bool disablePTimes)
[InlineData(false, true)] [InlineData(false, true)]
[InlineData(true, false)] [InlineData(true, false)]
[InlineData(false, false)] [InlineData(false, false)]
public void TestBasicExpiryDateTime(bool disablePTimes, bool utc) public async Task TestBasicExpiryDateTime(bool disablePTimes, bool utc)
{ {
using (var muxer = Create(disabledCommands: GetMap(disablePTimes))) using (var muxer = Create(disabledCommands: GetMap(disablePTimes)))
{ {
...@@ -70,18 +71,18 @@ public void TestBasicExpiryDateTime(bool disablePTimes, bool utc) ...@@ -70,18 +71,18 @@ public void TestBasicExpiryDateTime(bool disablePTimes, bool utc)
conn.KeyExpire(key, DateTime.MaxValue, CommandFlags.FireAndForget); conn.KeyExpire(key, DateTime.MaxValue, CommandFlags.FireAndForget);
var e = conn.KeyTimeToLiveAsync(key); var e = conn.KeyTimeToLiveAsync(key);
Assert.Null(muxer.Wait(a)); Assert.Null(await a);
var time = muxer.Wait(b); var time = await b;
Assert.NotNull(time); Assert.NotNull(time);
Log("Time: {0}, Expected: {1}-{2}", time, TimeSpan.FromMinutes(59), TimeSpan.FromMinutes(60)); Log("Time: {0}, Expected: {1}-{2}", time, TimeSpan.FromMinutes(59), TimeSpan.FromMinutes(60));
Assert.True(time >= TimeSpan.FromMinutes(59)); Assert.True(time >= TimeSpan.FromMinutes(59));
Assert.True(time <= TimeSpan.FromMinutes(60)); Assert.True(time <= TimeSpan.FromMinutes(60));
Assert.Null(muxer.Wait(c)); Assert.Null(await c);
time = muxer.Wait(d); time = await d;
Assert.NotNull(time); Assert.NotNull(time);
Assert.True(time >= TimeSpan.FromMinutes(89)); Assert.True(time >= TimeSpan.FromMinutes(89));
Assert.True(time <= TimeSpan.FromMinutes(90)); Assert.True(time <= TimeSpan.FromMinutes(90));
Assert.Null(muxer.Wait(e)); Assert.Null(await e);
} }
} }
} }
......
...@@ -150,12 +150,12 @@ public async Task HashIncrDecrFloatingPointAsync() ...@@ -150,12 +150,12 @@ public async Task HashIncrDecrFloatingPointAsync()
double sum = 0; double sum = 0;
foreach (var value in incr) foreach (var value in incr)
{ {
await db.HashIncrementAsync(key, field, value).ForAwait(); var t = db.HashIncrementAsync(key, field, value);
sum += value; sum += value;
} }
foreach (var value in decr) foreach (var value in decr)
{ {
await db.HashDecrementAsync(key, field, value).ForAwait(); var t = db.HashDecrementAsync(key, field, value);
sum -= value; sum -= value;
} }
var val = (double)await db.HashGetAsync(key, field).ForAwait(); var val = (double)await db.HashGetAsync(key, field).ForAwait();
......
...@@ -23,7 +23,7 @@ public void GeoAdd() ...@@ -23,7 +23,7 @@ public void GeoAdd()
Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo); Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo);
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
// add while not there // add while not there
Assert.True(db.GeoAdd(key, cefalù.Longitude, cefalù.Latitude, cefalù.Member)); Assert.True(db.GeoAdd(key, cefalù.Longitude, cefalù.Latitude, cefalù.Member));
...@@ -51,8 +51,8 @@ public void GetDistance() ...@@ -51,8 +51,8 @@ public void GetDistance()
Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo); Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo);
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.GeoAdd(key, all); db.GeoAdd(key, all, CommandFlags.FireAndForget);
var val = db.GeoDistance(key, "Palermo", "Catania", GeoUnit.Meters); var val = db.GeoDistance(key, "Palermo", "Catania", GeoUnit.Meters);
Assert.True(val.HasValue); Assert.True(val.HasValue);
var rounded = Math.Round(val.Value, 10); var rounded = Math.Round(val.Value, 10);
...@@ -71,8 +71,8 @@ public void GeoHash() ...@@ -71,8 +71,8 @@ public void GeoHash()
Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo); Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo);
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.GeoAdd(key, all); db.GeoAdd(key, all, CommandFlags.FireAndForget);
var hashes = db.GeoHash(key, new RedisValue[] { palermo.Member, "Nowhere", agrigento.Member }); var hashes = db.GeoHash(key, new RedisValue[] { palermo.Member, "Nowhere", agrigento.Member });
Assert.Equal(3, hashes.Length); Assert.Equal(3, hashes.Length);
...@@ -96,8 +96,8 @@ public void GeoGetPosition() ...@@ -96,8 +96,8 @@ public void GeoGetPosition()
Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo); Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo);
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.GeoAdd(key, all); db.GeoAdd(key, all, CommandFlags.FireAndForget);
var pos = db.GeoPosition(key, palermo.Member); var pos = db.GeoPosition(key, palermo.Member);
Assert.True(pos.HasValue); Assert.True(pos.HasValue);
...@@ -117,8 +117,8 @@ public void GeoRemove() ...@@ -117,8 +117,8 @@ public void GeoRemove()
Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo); Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo);
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.GeoAdd(key, all); db.GeoAdd(key, all, CommandFlags.FireAndForget);
var pos = db.GeoPosition(key, "Palermo"); var pos = db.GeoPosition(key, "Palermo");
Assert.True(pos.HasValue); Assert.True(pos.HasValue);
...@@ -140,8 +140,8 @@ public void GeoRadius() ...@@ -140,8 +140,8 @@ public void GeoRadius()
Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo); Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo);
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.GeoAdd(key, all); db.GeoAdd(key, all, CommandFlags.FireAndForget);
var results = db.GeoRadius(key, cefalù.Member, 60, GeoUnit.Miles, 2, Order.Ascending); var results = db.GeoRadius(key, cefalù.Member, 60, GeoUnit.Miles, 2, Order.Ascending);
Assert.Equal(2, results.Length); Assert.Equal(2, results.Length);
...@@ -180,7 +180,7 @@ public void GeoRadiusOverloads() ...@@ -180,7 +180,7 @@ public void GeoRadiusOverloads()
Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo); Skip.IfMissingFeature(conn, nameof(RedisFeatures.Geo), r => r.Geo);
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
Assert.True(db.GeoAdd(key, -1.759925, 52.19493, "steve")); Assert.True(db.GeoAdd(key, -1.759925, 52.19493, "steve"));
Assert.True(db.GeoAdd(key, -3.360655, 54.66395, "dave")); Assert.True(db.GeoAdd(key, -3.360655, 54.66395, "dave"));
......
This diff is collapsed.
...@@ -12,11 +12,12 @@ public class SO10504853 : TestBase ...@@ -12,11 +12,12 @@ public class SO10504853 : TestBase
[Fact] [Fact]
public void LoopLotsOfTrivialStuff() public void LoopLotsOfTrivialStuff()
{ {
var key = Me();
Trace.WriteLine("### init"); Trace.WriteLine("### init");
using (var muxer = Create()) using (var muxer = Create())
{ {
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
conn.KeyDelete("lots-trivial"); conn.KeyDelete(key, CommandFlags.FireAndForget);
} }
const int COUNT = 2; const int COUNT = 2;
for (int i = 0; i < COUNT; i++) for (int i = 0; i < COUNT; i++)
...@@ -25,14 +26,14 @@ public void LoopLotsOfTrivialStuff() ...@@ -25,14 +26,14 @@ public void LoopLotsOfTrivialStuff()
using (var muxer = Create()) using (var muxer = Create())
{ {
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
Assert.Equal(i + 1, conn.StringIncrement("lots-trivial")); Assert.Equal(i + 1, conn.StringIncrement(key));
} }
} }
Trace.WriteLine("### close"); Trace.WriteLine("### close");
using (var muxer = Create()) using (var muxer = Create())
{ {
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
Assert.Equal(COUNT, (long)conn.StringGet("lots-trivial")); Assert.Equal(COUNT, (long)conn.StringGet(key));
} }
} }
...@@ -42,12 +43,13 @@ public void ExecuteWithEmptyStartingPoint() ...@@ -42,12 +43,13 @@ public void ExecuteWithEmptyStartingPoint()
using (var muxer = Create()) using (var muxer = Create())
{ {
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
var key = Me();
var task = new { priority = 3 }; var task = new { priority = 3 };
conn.KeyDeleteAsync("item:1"); conn.KeyDeleteAsync(key);
conn.HashSetAsync("item:1", "something else", "abc"); conn.HashSetAsync(key, "something else", "abc");
conn.HashSetAsync("item:1", "priority", task.priority.ToString()); conn.HashSetAsync(key, "priority", task.priority.ToString());
var taskResult = conn.HashGetAsync("item:1", "priority"); var taskResult = conn.HashGetAsync(key, "priority");
conn.Wait(taskResult); conn.Wait(taskResult);
...@@ -60,17 +62,18 @@ public void ExecuteWithEmptyStartingPoint() ...@@ -60,17 +62,18 @@ public void ExecuteWithEmptyStartingPoint()
[Fact] [Fact]
public void ExecuteWithNonHashStartingPoint() public void ExecuteWithNonHashStartingPoint()
{ {
var key = Me();
Assert.Throws<RedisServerException>(() => Assert.Throws<RedisServerException>(() =>
{ {
using (var muxer = Create()) using (var muxer = Create())
{ {
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
var task = new { priority = 3 }; var task = new { priority = 3 };
conn.KeyDeleteAsync("item:1"); conn.KeyDeleteAsync(key);
conn.StringSetAsync("item:1", "not a hash"); conn.StringSetAsync(key, "not a hash");
conn.HashSetAsync("item:1", "priority", task.priority.ToString()); conn.HashSetAsync(key, "priority", task.priority.ToString());
var taskResult = conn.HashGetAsync("item:1", "priority"); var taskResult = conn.HashGetAsync(key, "priority");
try try
{ {
......
using System; using System;
using System.Text; using System.Text;
using System.Threading.Tasks;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
...@@ -10,7 +11,7 @@ public class SO10825542 : TestBase ...@@ -10,7 +11,7 @@ public class SO10825542 : TestBase
public SO10825542(ITestOutputHelper output) : base(output) { } public SO10825542(ITestOutputHelper output) : base(output) { }
[Fact] [Fact]
public void Execute() public async Task Execute()
{ {
using (var muxer = Create()) using (var muxer = Create())
{ {
...@@ -18,14 +19,13 @@ public void Execute() ...@@ -18,14 +19,13 @@ public void Execute()
var con = muxer.GetDatabase(); var con = muxer.GetDatabase();
// set the field value and expiration // set the field value and expiration
con.HashSetAsync(key, "field1", Encoding.UTF8.GetBytes("hello world")); var hsa = con.HashSetAsync(key, "field1", Encoding.UTF8.GetBytes("hello world"));
con.KeyExpireAsync(key, TimeSpan.FromSeconds(7200)); var kea = con.KeyExpireAsync(key, TimeSpan.FromSeconds(7200));
con.HashSetAsync(key, "field2", "fooobar"); var hsa2 = con.HashSetAsync(key, "field2", "fooobar");
var task = con.HashGetAllAsync(key); var result = await con.HashGetAllAsync(key).ForAwait();
con.Wait(task);
Assert.Equal(2, task.Result.Length); Assert.Equal(2, result.Length);
var dict = task.Result.ToStringDictionary(); var dict = result.ToStringDictionary();
Assert.Equal("hello world", dict["field1"]); Assert.Equal("hello world", dict["field1"]);
Assert.Equal("fooobar", dict["field2"]); Assert.Equal("fooobar", dict["field2"]);
} }
......
...@@ -19,9 +19,9 @@ public async Task Exec() ...@@ -19,9 +19,9 @@ public async Task Exec()
var cache = conn.GetDatabase(); var cache = conn.GetDatabase();
// setup some data // setup some data
cache.KeyDelete(key); cache.KeyDelete(key, CommandFlags.FireAndForget);
cache.HashSet(key, "full", "some value"); cache.HashSet(key, "full", "some value", flags: CommandFlags.FireAndForget);
cache.KeyExpire(key, TimeSpan.FromSeconds(3)); cache.KeyExpire(key, TimeSpan.FromSeconds(3), CommandFlags.FireAndForget);
// test while exists // test while exists
var keyExists = cache.KeyExists(key); var keyExists = cache.KeyExists(key);
...@@ -41,7 +41,7 @@ public async Task Exec() ...@@ -41,7 +41,7 @@ public async Task Exec()
Assert.False(keyExists); Assert.False(keyExists);
Assert.Null(ttl); Assert.Null(ttl);
var r = fullWait.Result; var r = await fullWait;
Assert.True(r.IsNull); Assert.True(r.IsNull);
Assert.Null((string)r); Assert.Null((string)r);
} }
......
using System; using System;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
...@@ -18,7 +17,7 @@ public async Task SetExpirationToPassed() ...@@ -18,7 +17,7 @@ public async Task SetExpirationToPassed()
{ {
// Given // Given
var cache = conn.GetDatabase(); var cache = conn.GetDatabase();
cache.KeyDelete(key); cache.KeyDelete(key, CommandFlags.FireAndForget);
cache.HashSet(key, "full", "test", When.NotExists, CommandFlags.PreferMaster); cache.HashSet(key, "full", "test", When.NotExists, CommandFlags.PreferMaster);
await Task.Delay(2000).ForAwait(); await Task.Delay(2000).ForAwait();
......
...@@ -38,7 +38,7 @@ public void FlushFetchRandomKey() ...@@ -38,7 +38,7 @@ public void FlushFetchRandomKey()
Skip.IfMissingDatabase(conn, dbId); Skip.IfMissingDatabase(conn, dbId);
var db = conn.GetDatabase(dbId); var db = conn.GetDatabase(dbId);
var prefix = Me(); var prefix = Me();
conn.GetServer(TestConfig.Current.MasterServerAndPort).FlushDatabase(dbId); conn.GetServer(TestConfig.Current.MasterServerAndPort).FlushDatabase(dbId, CommandFlags.FireAndForget);
string anyKey = db.KeyRandom(); string anyKey = db.KeyRandom();
Assert.Null(anyKey); Assert.Null(anyKey);
...@@ -56,12 +56,12 @@ public void Zeros() ...@@ -56,12 +56,12 @@ public void Zeros()
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
var key = Me(); var key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.StringSet(key, 123); db.StringSet(key, 123, flags: CommandFlags.FireAndForget);
int k = (int)db.StringGet(key); int k = (int)db.StringGet(key);
Assert.Equal(123, k); Assert.Equal(123, k);
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
int i = (int)db.StringGet(key); int i = (int)db.StringGet(key);
Assert.Equal(0, i); Assert.Equal(0, i);
......
...@@ -14,7 +14,7 @@ public void QueryRangeAndLengthByLex() ...@@ -14,7 +14,7 @@ public void QueryRangeAndLengthByLex()
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.SortedSetAdd(key, db.SortedSetAdd(key,
new SortedSetEntry[] new SortedSetEntry[]
...@@ -26,7 +26,7 @@ public void QueryRangeAndLengthByLex() ...@@ -26,7 +26,7 @@ public void QueryRangeAndLengthByLex()
new SortedSetEntry("e", 0), new SortedSetEntry("e", 0),
new SortedSetEntry("f", 0), new SortedSetEntry("f", 0),
new SortedSetEntry("g", 0), new SortedSetEntry("g", 0),
}); }, CommandFlags.FireAndForget);
var set = db.SortedSetRangeByValue(key, default(RedisValue), "c"); var set = db.SortedSetRangeByValue(key, default(RedisValue), "c");
var count = db.SortedSetLengthByValue(key, default(RedisValue), "c"); var count = db.SortedSetLengthByValue(key, default(RedisValue), "c");
...@@ -58,7 +58,7 @@ public void RemoveRangeByLex() ...@@ -58,7 +58,7 @@ public void RemoveRangeByLex()
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.SortedSetAdd(key, db.SortedSetAdd(key,
new SortedSetEntry[] new SortedSetEntry[]
...@@ -68,7 +68,7 @@ public void RemoveRangeByLex() ...@@ -68,7 +68,7 @@ public void RemoveRangeByLex()
new SortedSetEntry("c", 0), new SortedSetEntry("c", 0),
new SortedSetEntry("d", 0), new SortedSetEntry("d", 0),
new SortedSetEntry("e", 0), new SortedSetEntry("e", 0),
}); }, CommandFlags.FireAndForget);
db.SortedSetAdd(key, db.SortedSetAdd(key,
new SortedSetEntry[] new SortedSetEntry[]
{ {
...@@ -77,7 +77,7 @@ public void RemoveRangeByLex() ...@@ -77,7 +77,7 @@ public void RemoveRangeByLex()
new SortedSetEntry("zip", 0), new SortedSetEntry("zip", 0),
new SortedSetEntry("ALPHA", 0), new SortedSetEntry("ALPHA", 0),
new SortedSetEntry("alpha", 0), new SortedSetEntry("alpha", 0),
}); }, CommandFlags.FireAndForget);
var set = db.SortedSetRangeByRank(key); var set = db.SortedSetRangeByRank(key);
Equate(set, set.Length, "ALPHA", "aaaa", "alpha", "b", "c", "d", "e", "foo", "zap", "zip"); Equate(set, set.Length, "ALPHA", "aaaa", "alpha", "b", "c", "d", "e", "foo", "zap", "zip");
......
...@@ -17,18 +17,18 @@ public void Ranges() ...@@ -17,18 +17,18 @@ public void Ranges()
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key, CommandFlags.FireAndForget); db.KeyDelete(key, CommandFlags.FireAndForget);
db.ListRightPush(key, "abcdefghijklmnopqrstuvwxyz".Select(x => (RedisValue)x.ToString()).ToArray()); db.ListRightPush(key, "abcdefghijklmnopqrstuvwxyz".Select(x => (RedisValue)x.ToString()).ToArray(), CommandFlags.FireAndForget);
Assert.Equal(26, db.ListLength(key)); Assert.Equal(26, db.ListLength(key));
Assert.Equal("abcdefghijklmnopqrstuvwxyz", string.Concat(db.ListRange(key))); Assert.Equal("abcdefghijklmnopqrstuvwxyz", string.Concat(db.ListRange(key)));
var last10 = db.ListRange(key, -10, -1); var last10 = db.ListRange(key, -10, -1);
Assert.Equal("qrstuvwxyz", string.Concat(last10)); Assert.Equal("qrstuvwxyz", string.Concat(last10));
db.ListTrim(key, 0, -11); db.ListTrim(key, 0, -11, CommandFlags.FireAndForget);
Assert.Equal(16, db.ListLength(key)); Assert.Equal(16, db.ListLength(key));
Assert.Equal("abcdefghijklmnop", string.Concat(db.ListRange(key))); Assert.Equal("abcdefghijklmnop", string.Concat(db.ListRange(key)));
} }
} }
} }
} }
\ No newline at end of file
...@@ -72,35 +72,8 @@ public void TestOpCountByVersionLocal_UpLevel() ...@@ -72,35 +72,8 @@ public void TestOpCountByVersionLocal_UpLevel()
{ {
TestLockOpCountByVersion(conn, 1, false); TestLockOpCountByVersion(conn, 1, false);
TestLockOpCountByVersion(conn, 1, true); TestLockOpCountByVersion(conn, 1, true);
//TestManualLockOpCountByVersion(conn, 5, false);
//TestManualLockOpCountByVersion(conn, 3, true);
} }
} }
//[Test]
//public void TestOpCountByVersionLocal_DownLevel()
//{
// using (var conn = GetUnsecuredConnection(open: false))
// {
// conn.SetServerVersion(new Version(2, 6, 0), ServerType.Master);
// TestLockOpCountByVersion(conn, 5, false);
// TestLockOpCountByVersion(conn, 3, true);
// //TestManualLockOpCountByVersion(conn, 5, false);
// //TestManualLockOpCountByVersion(conn, 3, true);
// }
//}
//[Test]
//public void TestOpCountByVersionRemote()
//{
// using (var conn = GetRemoteConnection(open: false))
// {
// TestLockOpCountByVersion(conn, 1, false);
// TestLockOpCountByVersion(conn, 1, true);
// //TestManualLockOpCountByVersion(conn, 1, false);
// //TestManualLockOpCountByVersion(conn, 1, true);
// }
//}
private void TestLockOpCountByVersion(ConnectionMultiplexer conn, int expectedOps, bool existFirst) private void TestLockOpCountByVersion(ConnectionMultiplexer conn, int expectedOps, bool existFirst)
{ {
...@@ -108,13 +81,13 @@ private void TestLockOpCountByVersion(ConnectionMultiplexer conn, int expectedOp ...@@ -108,13 +81,13 @@ private void TestLockOpCountByVersion(ConnectionMultiplexer conn, int expectedOp
RedisKey Key = Me(); RedisKey Key = Me();
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(Key); db.KeyDelete(Key, CommandFlags.FireAndForget);
RedisValue newVal = "us:" + Guid.NewGuid().ToString(); RedisValue newVal = "us:" + Guid.NewGuid().ToString();
RedisValue expectedVal = newVal; RedisValue expectedVal = newVal;
if (existFirst) if (existFirst)
{ {
expectedVal = "other:" + Guid.NewGuid().ToString(); expectedVal = "other:" + Guid.NewGuid().ToString();
db.StringSet(Key, expectedVal, TimeSpan.FromSeconds(LockDuration)); db.StringSet(Key, expectedVal, TimeSpan.FromSeconds(LockDuration), flags: CommandFlags.FireAndForget);
} }
long countBefore = GetServer(conn).GetCounters().Interactive.OperationCount; long countBefore = GetServer(conn).GetCounters().Interactive.OperationCount;
...@@ -145,7 +118,7 @@ private ConnectionMultiplexer Create(TestMode mode) ...@@ -145,7 +118,7 @@ private ConnectionMultiplexer Create(TestMode mode)
} }
[Theory, MemberData(nameof(TestModes))] [Theory, MemberData(nameof(TestModes))]
public void TakeLockAndExtend(TestMode mode) public async Task TakeLockAndExtend(TestMode mode)
{ {
bool withTran = mode == TestMode.MultiExec; bool withTran = mode == TestMode.MultiExec;
using (var conn = Create(mode)) using (var conn = Create(mode))
...@@ -158,7 +131,7 @@ public void TakeLockAndExtend(TestMode mode) ...@@ -158,7 +131,7 @@ public void TakeLockAndExtend(TestMode mode)
var db = conn.GetDatabase(DB); var db = conn.GetDatabase(DB);
db.KeyDelete(Key); db.KeyDelete(Key, CommandFlags.FireAndForget);
var t1 = db.LockTakeAsync(Key, right, TimeSpan.FromSeconds(20)); var t1 = db.LockTakeAsync(Key, right, TimeSpan.FromSeconds(20));
var t1b = db.LockTakeAsync(Key, wrong, TimeSpan.FromSeconds(10)); var t1b = db.LockTakeAsync(Key, wrong, TimeSpan.FromSeconds(10));
...@@ -178,22 +151,22 @@ public void TakeLockAndExtend(TestMode mode) ...@@ -178,22 +151,22 @@ public void TakeLockAndExtend(TestMode mode)
Assert.NotEqual(default(RedisValue), right); Assert.NotEqual(default(RedisValue), right);
Assert.NotEqual(default(RedisValue), wrong); Assert.NotEqual(default(RedisValue), wrong);
Assert.NotEqual(right, wrong); Assert.NotEqual(right, wrong);
Assert.True(conn.Wait(t1), "1"); Assert.True(await t1, "1");
Assert.False(conn.Wait(t1b), "1b"); Assert.False(await t1b, "1b");
Assert.Equal(right, conn.Wait(t2)); Assert.Equal(right, await t2);
if (withTran) Assert.False(conn.Wait(t3), "3"); if (withTran) Assert.False(await t3, "3");
Assert.Equal(right, conn.Wait(t4)); Assert.Equal(right, await t4);
if (withTran) Assert.False(conn.Wait(t5), "5"); if (withTran) Assert.False(await t5, "5");
Assert.Equal(right, conn.Wait(t6)); Assert.Equal(right, await t6);
var ttl = conn.Wait(t7).Value.TotalSeconds; var ttl = (await t7).Value.TotalSeconds;
Assert.True(ttl > 0 && ttl <= 20, "7"); Assert.True(ttl > 0 && ttl <= 20, "7");
Assert.True(conn.Wait(t8), "8"); Assert.True(await t8, "8");
Assert.Equal(right, conn.Wait(t9)); Assert.Equal(right, await t9);
ttl = conn.Wait(t10).Value.TotalSeconds; ttl = (await t10).Value.TotalSeconds;
Assert.True(ttl > 50 && ttl <= 60, "10"); Assert.True(ttl > 50 && ttl <= 60, "10");
Assert.True(conn.Wait(t11), "11"); Assert.True(await t11, "11");
Assert.Null((string)conn.Wait(t12)); Assert.Null((string)await t12);
Assert.True(conn.Wait(t13), "13"); Assert.True(await t13, "13");
} }
} }
...@@ -226,7 +199,7 @@ public void TakeLockAndExtend(TestMode mode) ...@@ -226,7 +199,7 @@ public void TakeLockAndExtend(TestMode mode)
//} //}
[Theory, MemberData(nameof(TestModes))] [Theory, MemberData(nameof(TestModes))]
public void TestBasicLockNotTaken(TestMode testMode) public async Task TestBasicLockNotTaken(TestMode testMode)
{ {
using (var conn = Create(testMode)) using (var conn = Create(testMode))
{ {
...@@ -241,14 +214,14 @@ public void TestBasicLockNotTaken(TestMode testMode) ...@@ -241,14 +214,14 @@ public void TestBasicLockNotTaken(TestMode testMode)
var key = Me(); var key = Me();
for (int i = 0; i < LOOP; i++) for (int i = 0; i < LOOP; i++)
{ {
db.KeyDeleteAsync(key); var d = db.KeyDeleteAsync(key);
taken = db.LockTakeAsync(key, "new-value", TimeSpan.FromSeconds(10)); taken = db.LockTakeAsync(key, "new-value", TimeSpan.FromSeconds(10));
newValue = db.StringGetAsync(key); newValue = db.StringGetAsync(key);
ttl = db.KeyTimeToLiveAsync(key); ttl = db.KeyTimeToLiveAsync(key);
} }
Assert.True(conn.Wait(taken), "taken"); Assert.True(await taken, "taken");
Assert.Equal("new-value", (string)conn.Wait(newValue)); Assert.Equal("new-value", (string)await newValue);
var ttlValue = conn.Wait(ttl).Value.TotalSeconds; var ttlValue = (await ttl).Value.TotalSeconds;
Assert.True(ttlValue >= 8 && ttlValue <= 10, "ttl"); Assert.True(ttlValue >= 8 && ttlValue <= 10, "ttl");
Assert.Equal(0, errorCount); Assert.Equal(0, errorCount);
...@@ -256,21 +229,21 @@ public void TestBasicLockNotTaken(TestMode testMode) ...@@ -256,21 +229,21 @@ public void TestBasicLockNotTaken(TestMode testMode)
} }
[Theory, MemberData(nameof(TestModes))] [Theory, MemberData(nameof(TestModes))]
public void TestBasicLockTaken(TestMode testMode) public async Task TestBasicLockTaken(TestMode testMode)
{ {
using (var conn = Create(testMode)) using (var conn = Create(testMode))
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
var key = Me(); var key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.StringSet(key, "old-value", TimeSpan.FromSeconds(20)); db.StringSet(key, "old-value", TimeSpan.FromSeconds(20), flags: CommandFlags.FireAndForget);
var taken = db.LockTakeAsync(key, "new-value", TimeSpan.FromSeconds(10)); var taken = db.LockTakeAsync(key, "new-value", TimeSpan.FromSeconds(10));
var newValue = db.StringGetAsync(key); var newValue = db.StringGetAsync(key);
var ttl = db.KeyTimeToLiveAsync(key); var ttl = db.KeyTimeToLiveAsync(key);
Assert.False(conn.Wait(taken), "taken"); Assert.False(await taken, "taken");
Assert.Equal("old-value", (string)conn.Wait(newValue)); Assert.Equal("old-value", (string)await newValue);
var ttlValue = conn.Wait(ttl).Value.TotalSeconds; var ttlValue = (await ttl).Value.TotalSeconds;
Assert.True(ttlValue >= 18 && ttlValue <= 20, "ttl"); Assert.True(ttlValue >= 18 && ttlValue <= 20, "ttl");
} }
} }
......
...@@ -53,7 +53,7 @@ public void MassiveBulkOpsSync(int threads) ...@@ -53,7 +53,7 @@ public void MassiveBulkOpsSync(int threads)
{ {
RedisKey key = "MBOS"; RedisKey key = "MBOS";
var conn = muxer.GetDatabase(); var conn = muxer.GetDatabase();
conn.KeyDelete(key); conn.KeyDelete(key, CommandFlags.FireAndForget);
#if DEBUG #if DEBUG
long oldAlloc = ConnectionMultiplexer.GetResultBoxAllocationCount(); long oldAlloc = ConnectionMultiplexer.GetResultBoxAllocationCount();
#endif #endif
...@@ -61,7 +61,7 @@ public void MassiveBulkOpsSync(int threads) ...@@ -61,7 +61,7 @@ public void MassiveBulkOpsSync(int threads)
{ {
for (int i = 0; i < workPerThread; i++) for (int i = 0; i < workPerThread; i++)
{ {
conn.StringIncrement(key); conn.StringIncrement(key, flags: CommandFlags.FireAndForget);
} }
}, threads); }, threads);
......
...@@ -8,9 +8,10 @@ public class Migrate : TestBase ...@@ -8,9 +8,10 @@ public class Migrate : TestBase
{ {
public Migrate(ITestOutputHelper output) : base (output) { } public Migrate(ITestOutputHelper output) : base (output) { }
[Fact]
public void Basic() public void Basic()
{ {
var fromConfig = new ConfigurationOptions { EndPoints = { { TestConfig.Current.MasterServer, TestConfig.Current.SecurePort } }, Password = TestConfig.Current.SecurePassword }; var fromConfig = new ConfigurationOptions { EndPoints = { { TestConfig.Current.SecureServer, TestConfig.Current.SecurePort } }, Password = TestConfig.Current.SecurePassword };
var toConfig = new ConfigurationOptions { EndPoints = { { TestConfig.Current.MasterServer, TestConfig.Current.MasterPort } } }; var toConfig = new ConfigurationOptions { EndPoints = { { TestConfig.Current.MasterServer, TestConfig.Current.MasterPort } } };
using (var from = ConnectionMultiplexer.Connect(fromConfig)) using (var from = ConnectionMultiplexer.Connect(fromConfig))
using (var to = ConnectionMultiplexer.Connect(toConfig)) using (var to = ConnectionMultiplexer.Connect(toConfig))
...@@ -18,11 +19,11 @@ public void Basic() ...@@ -18,11 +19,11 @@ public void Basic()
RedisKey key = Me(); RedisKey key = Me();
var fromDb = from.GetDatabase(); var fromDb = from.GetDatabase();
var toDb = to.GetDatabase(); var toDb = to.GetDatabase();
fromDb.KeyDelete(key); fromDb.KeyDelete(key, CommandFlags.FireAndForget);
toDb.KeyDelete(key); toDb.KeyDelete(key, CommandFlags.FireAndForget);
fromDb.StringSet(key, "foo"); fromDb.StringSet(key, "foo", flags: CommandFlags.FireAndForget);
var dest = to.GetEndPoints(true).Single(); var dest = to.GetEndPoints(true).Single();
fromDb.KeyMigrate(key, dest); fromDb.KeyMigrate(key, dest, flags: CommandFlags.FireAndForget);
Assert.False(fromDb.KeyExists(key)); Assert.False(fromDb.KeyExists(key));
Assert.True(toDb.KeyExists(key)); Assert.True(toDb.KeyExists(key));
string s = toDb.StringGet(key); string s = toDb.StringGet(key);
......
...@@ -16,22 +16,22 @@ public void AddSortedSetEveryWay() ...@@ -16,22 +16,22 @@ public void AddSortedSetEveryWay()
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.SortedSetAdd(key, "a", 1); db.SortedSetAdd(key, "a", 1, CommandFlags.FireAndForget);
db.SortedSetAdd(key, new[] { db.SortedSetAdd(key, new[] {
new SortedSetEntry("b", 2) }); new SortedSetEntry("b", 2) }, CommandFlags.FireAndForget);
db.SortedSetAdd(key, new[] { db.SortedSetAdd(key, new[] {
new SortedSetEntry("c", 3), new SortedSetEntry("c", 3),
new SortedSetEntry("d", 4)}); new SortedSetEntry("d", 4)}, CommandFlags.FireAndForget);
db.SortedSetAdd(key, new[] { db.SortedSetAdd(key, new[] {
new SortedSetEntry("e", 5), new SortedSetEntry("e", 5),
new SortedSetEntry("f", 6), new SortedSetEntry("f", 6),
new SortedSetEntry("g", 7)}); new SortedSetEntry("g", 7)}, CommandFlags.FireAndForget);
db.SortedSetAdd(key, new[] { db.SortedSetAdd(key, new[] {
new SortedSetEntry("h", 8), new SortedSetEntry("h", 8),
new SortedSetEntry("i", 9), new SortedSetEntry("i", 9),
new SortedSetEntry("j", 10), new SortedSetEntry("j", 10),
new SortedSetEntry("k", 11)}); new SortedSetEntry("k", 11)}, CommandFlags.FireAndForget);
var vals = db.SortedSetRangeByScoreWithScores(key); var vals = db.SortedSetRangeByScoreWithScores(key);
string s = string.Join(",", vals.OrderByDescending(x => x.Score).Select(x => x.Element)); string s = string.Join(",", vals.OrderByDescending(x => x.Score).Select(x => x.Element));
Assert.Equal("k,j,i,h,g,f,e,d,c,b,a", s); Assert.Equal("k,j,i,h,g,f,e,d,c,b,a", s);
...@@ -48,22 +48,22 @@ public void AddHashEveryWay() ...@@ -48,22 +48,22 @@ public void AddHashEveryWay()
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.HashSet(key, "a", 1); db.HashSet(key, "a", 1, flags: CommandFlags.FireAndForget);
db.HashSet(key, new[] { db.HashSet(key, new[] {
new HashEntry("b", 2) }); new HashEntry("b", 2) }, CommandFlags.FireAndForget);
db.HashSet(key, new[] { db.HashSet(key, new[] {
new HashEntry("c", 3), new HashEntry("c", 3),
new HashEntry("d", 4)}); new HashEntry("d", 4)}, CommandFlags.FireAndForget);
db.HashSet(key, new[] { db.HashSet(key, new[] {
new HashEntry("e", 5), new HashEntry("e", 5),
new HashEntry("f", 6), new HashEntry("f", 6),
new HashEntry("g", 7)}); new HashEntry("g", 7)}, CommandFlags.FireAndForget);
db.HashSet(key, new[] { db.HashSet(key, new[] {
new HashEntry("h", 8), new HashEntry("h", 8),
new HashEntry("i", 9), new HashEntry("i", 9),
new HashEntry("j", 10), new HashEntry("j", 10),
new HashEntry("k", 11)}); new HashEntry("k", 11)}, CommandFlags.FireAndForget);
var vals = db.HashGetAll(key); var vals = db.HashGetAll(key);
string s = string.Join(",", vals.OrderByDescending(x => (double)x.Value).Select(x => x.Name)); string s = string.Join(",", vals.OrderByDescending(x => (double)x.Value).Select(x => x.Name));
Assert.Equal("k,j,i,h,g,f,e,d,c,b,a", s); Assert.Equal("k,j,i,h,g,f,e,d,c,b,a", s);
...@@ -80,12 +80,12 @@ public void AddSetEveryWay() ...@@ -80,12 +80,12 @@ public void AddSetEveryWay()
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.SetAdd(key, "a"); db.SetAdd(key, "a", CommandFlags.FireAndForget);
db.SetAdd(key, new RedisValue[] { "b" }); db.SetAdd(key, new RedisValue[] { "b" }, CommandFlags.FireAndForget);
db.SetAdd(key, new RedisValue[] { "c", "d" }); db.SetAdd(key, new RedisValue[] { "c", "d" }, CommandFlags.FireAndForget);
db.SetAdd(key, new RedisValue[] { "e", "f", "g" }); db.SetAdd(key, new RedisValue[] { "e", "f", "g" }, CommandFlags.FireAndForget);
db.SetAdd(key, new RedisValue[] { "h", "i", "j", "k" }); db.SetAdd(key, new RedisValue[] { "h", "i", "j", "k" }, CommandFlags.FireAndForget);
var vals = db.SetMembers(key); var vals = db.SetMembers(key);
string s = string.Join(",", vals.OrderByDescending(x => x)); string s = string.Join(",", vals.OrderByDescending(x => x));
...@@ -101,12 +101,12 @@ public void AddSetEveryWayNumbers() ...@@ -101,12 +101,12 @@ public void AddSetEveryWayNumbers()
var db = conn.GetDatabase(); var db = conn.GetDatabase();
RedisKey key = Me(); RedisKey key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.SetAdd(key, "a"); db.SetAdd(key, "a", CommandFlags.FireAndForget);
db.SetAdd(key, new RedisValue[] { "1" }); db.SetAdd(key, new RedisValue[] { "1" }, CommandFlags.FireAndForget);
db.SetAdd(key, new RedisValue[] { "11", "2" }); db.SetAdd(key, new RedisValue[] { "11", "2" }, CommandFlags.FireAndForget);
db.SetAdd(key, new RedisValue[] { "10", "3", "1.5" }); db.SetAdd(key, new RedisValue[] { "10", "3", "1.5" }, CommandFlags.FireAndForget);
db.SetAdd(key, new RedisValue[] { "2.2", "-1", "s", "t" }); db.SetAdd(key, new RedisValue[] { "2.2", "-1", "s", "t" }, CommandFlags.FireAndForget);
var vals = db.SetMembers(key); var vals = db.SetMembers(key);
string s = string.Join(",", vals.OrderByDescending(x => x)); string s = string.Join(",", vals.OrderByDescending(x => x));
......
...@@ -530,7 +530,7 @@ public async Task PubSubGetAllCorrectOrder_OnMessage_Async() ...@@ -530,7 +530,7 @@ public async Task PubSubGetAllCorrectOrder_OnMessage_Async()
} }
[Fact] [Fact]
public void TestPublishWithSubscribers() public async Task TestPublishWithSubscribers()
{ {
var channel = Me(); var channel = Me();
using (var muxerA = Create()) using (var muxerA = Create())
...@@ -542,11 +542,10 @@ public void TestPublishWithSubscribers() ...@@ -542,11 +542,10 @@ public void TestPublishWithSubscribers()
var t1 = listenA.SubscribeAsync(channel, delegate { }); var t1 = listenA.SubscribeAsync(channel, delegate { });
var t2 = listenB.SubscribeAsync(channel, delegate { }); var t2 = listenB.SubscribeAsync(channel, delegate { });
listenA.Wait(t1); await Task.WhenAll(t1, t2).ForAwait();
listenB.Wait(t2);
var pub = conn.GetSubscriber().PublishAsync(channel, "message"); var pub = conn.GetSubscriber().PublishAsync(channel, "message");
Assert.Equal(2, conn.Wait(pub)); // delivery count Assert.Equal(2, await pub); // delivery count
} }
} }
...@@ -565,8 +564,7 @@ public async Task TestMultipleSubscribersGetMessage() ...@@ -565,8 +564,7 @@ public async Task TestMultipleSubscribersGetMessage()
int gotA = 0, gotB = 0; int gotA = 0, gotB = 0;
var tA = listenA.SubscribeAsync(channel, (_, msg) => { if (msg == "message") Interlocked.Increment(ref gotA); }); var tA = listenA.SubscribeAsync(channel, (_, msg) => { if (msg == "message") Interlocked.Increment(ref gotA); });
var tB = listenB.SubscribeAsync(channel, (_, msg) => { if (msg == "message") Interlocked.Increment(ref gotB); }); var tB = listenB.SubscribeAsync(channel, (_, msg) => { if (msg == "message") Interlocked.Increment(ref gotB); });
listenA.Wait(tA); await Task.WhenAll(tA, tB).ForAwait();
listenB.Wait(tB);
Assert.Equal(2, pub.Publish(channel, "message")); Assert.Equal(2, pub.Publish(channel, "message"));
await AllowReasonableTimeToPublishAndProcess().ForAwait(); await AllowReasonableTimeToPublishAndProcess().ForAwait();
Assert.Equal(1, Interlocked.CompareExchange(ref gotA, 0, 0)); Assert.Equal(1, Interlocked.CompareExchange(ref gotA, 0, 0));
...@@ -574,7 +572,7 @@ public async Task TestMultipleSubscribersGetMessage() ...@@ -574,7 +572,7 @@ public async Task TestMultipleSubscribersGetMessage()
// and unsubscibe... // and unsubscibe...
tA = listenA.UnsubscribeAsync(channel); tA = listenA.UnsubscribeAsync(channel);
listenA.Wait(tA); await tA;
Assert.Equal(1, pub.Publish(channel, "message")); Assert.Equal(1, pub.Publish(channel, "message"));
await AllowReasonableTimeToPublishAndProcess().ForAwait(); await AllowReasonableTimeToPublishAndProcess().ForAwait();
Assert.Equal(1, Interlocked.CompareExchange(ref gotA, 0, 0)); Assert.Equal(1, Interlocked.CompareExchange(ref gotA, 0, 0));
...@@ -596,14 +594,14 @@ public async Task Issue38() ...@@ -596,14 +594,14 @@ public async Task Issue38()
var a1 = sub.SubscribeAsync(prefix + "bar", handler); var a1 = sub.SubscribeAsync(prefix + "bar", handler);
var b0 = sub.SubscribeAsync(prefix + "f*o", handler); var b0 = sub.SubscribeAsync(prefix + "f*o", handler);
var b1 = sub.SubscribeAsync(prefix + "b*r", handler); var b1 = sub.SubscribeAsync(prefix + "b*r", handler);
sub.WaitAll(a0, a1, b0, b1); await Task.WhenAll(a0, a1, b0, b1).ForAwait();
var c = sub.PublishAsync(prefix + "foo", "foo"); var c = sub.PublishAsync(prefix + "foo", "foo");
var d = sub.PublishAsync(prefix + "f@o", "f@o"); var d = sub.PublishAsync(prefix + "f@o", "f@o");
var e = sub.PublishAsync(prefix + "bar", "bar"); var e = sub.PublishAsync(prefix + "bar", "bar");
var f = sub.PublishAsync(prefix + "b@r", "b@r"); var f = sub.PublishAsync(prefix + "b@r", "b@r");
await Task.WhenAll(c, d, e, f).ForAwait();
pub.WaitAll(c, d, e, f);
long total = c.Result + d.Result + e.Result + f.Result; long total = c.Result + d.Result + e.Result + f.Result;
await AllowReasonableTimeToPublishAndProcess().ForAwait(); await AllowReasonableTimeToPublishAndProcess().ForAwait();
...@@ -629,8 +627,7 @@ public async Task TestPartialSubscriberGetMessage() ...@@ -629,8 +627,7 @@ public async Task TestPartialSubscriberGetMessage()
var prefix = Me(); var prefix = Me();
var tA = listenA.SubscribeAsync(prefix + "channel", (s, msg) => { if (s == prefix + "channel" && msg == "message") Interlocked.Increment(ref gotA); }); var tA = listenA.SubscribeAsync(prefix + "channel", (s, msg) => { if (s == prefix + "channel" && msg == "message") Interlocked.Increment(ref gotA); });
var tB = listenB.SubscribeAsync(prefix + "chann*", (s, msg) => { if (s == prefix + "channel" && msg == "message") Interlocked.Increment(ref gotB); }); var tB = listenB.SubscribeAsync(prefix + "chann*", (s, msg) => { if (s == prefix + "channel" && msg == "message") Interlocked.Increment(ref gotB); });
listenA.Wait(tA); await Task.WhenAll(tA, tB).ForAwait();
listenB.Wait(tB);
Assert.Equal(2, pub.Publish(prefix + "channel", "message")); Assert.Equal(2, pub.Publish(prefix + "channel", "message"));
await AllowReasonableTimeToPublishAndProcess().ForAwait(); await AllowReasonableTimeToPublishAndProcess().ForAwait();
Assert.Equal(1, Interlocked.CompareExchange(ref gotA, 0, 0)); Assert.Equal(1, Interlocked.CompareExchange(ref gotA, 0, 0));
...@@ -638,7 +635,7 @@ public async Task TestPartialSubscriberGetMessage() ...@@ -638,7 +635,7 @@ public async Task TestPartialSubscriberGetMessage()
// and unsubscibe... // and unsubscibe...
tB = listenB.UnsubscribeAsync(prefix + "chann*", null); tB = listenB.UnsubscribeAsync(prefix + "chann*", null);
listenB.Wait(tB); await tB;
Assert.Equal(1, pub.Publish(prefix + "channel", "message")); Assert.Equal(1, pub.Publish(prefix + "channel", "message"));
await AllowReasonableTimeToPublishAndProcess().ForAwait(); await AllowReasonableTimeToPublishAndProcess().ForAwait();
Assert.Equal(2, Interlocked.CompareExchange(ref gotA, 0, 0)); Assert.Equal(2, Interlocked.CompareExchange(ref gotA, 0, 0));
...@@ -658,20 +655,20 @@ public async Task TestSubscribeUnsubscribeAndSubscribeAgain() ...@@ -658,20 +655,20 @@ public async Task TestSubscribeUnsubscribeAndSubscribeAgain()
int x = 0, y = 0; int x = 0, y = 0;
var t1 = sub.SubscribeAsync(prefix + "abc", delegate { Interlocked.Increment(ref x); }); var t1 = sub.SubscribeAsync(prefix + "abc", delegate { Interlocked.Increment(ref x); });
var t2 = sub.SubscribeAsync(prefix + "ab*", delegate { Interlocked.Increment(ref y); }); var t2 = sub.SubscribeAsync(prefix + "ab*", delegate { Interlocked.Increment(ref y); });
sub.WaitAll(t1, t2); await Task.WhenAll(t1, t2).ForAwait();
pub.Publish(prefix + "abc", ""); pub.Publish(prefix + "abc", "");
await AllowReasonableTimeToPublishAndProcess().ForAwait(); await AllowReasonableTimeToPublishAndProcess().ForAwait();
Assert.Equal(1, Volatile.Read(ref x)); Assert.Equal(1, Volatile.Read(ref x));
Assert.Equal(1, Volatile.Read(ref y)); Assert.Equal(1, Volatile.Read(ref y));
t1 = sub.UnsubscribeAsync(prefix + "abc", null); t1 = sub.UnsubscribeAsync(prefix + "abc", null);
t2 = sub.UnsubscribeAsync(prefix + "ab*", null); t2 = sub.UnsubscribeAsync(prefix + "ab*", null);
sub.WaitAll(t1, t2); await Task.WhenAll(t1, t2).ForAwait();
pub.Publish(prefix + "abc", ""); pub.Publish(prefix + "abc", "");
Assert.Equal(1, Volatile.Read(ref x)); Assert.Equal(1, Volatile.Read(ref x));
Assert.Equal(1, Volatile.Read(ref y)); Assert.Equal(1, Volatile.Read(ref y));
t1 = sub.SubscribeAsync(prefix + "abc", delegate { Interlocked.Increment(ref x); }); t1 = sub.SubscribeAsync(prefix + "abc", delegate { Interlocked.Increment(ref x); });
t2 = sub.SubscribeAsync(prefix + "ab*", delegate { Interlocked.Increment(ref y); }); t2 = sub.SubscribeAsync(prefix + "ab*", delegate { Interlocked.Increment(ref y); });
sub.WaitAll(t1, t2); await Task.WhenAll(t1, t2).ForAwait();
pub.Publish(prefix + "abc", ""); pub.Publish(prefix + "abc", "");
await AllowReasonableTimeToPublishAndProcess().ForAwait(); await AllowReasonableTimeToPublishAndProcess().ForAwait();
Assert.Equal(2, Volatile.Read(ref x)); Assert.Equal(2, Volatile.Read(ref x));
......
...@@ -21,9 +21,9 @@ public void ConnectToSSDB() ...@@ -21,9 +21,9 @@ public void ConnectToSSDB()
using (var conn = ConnectionMultiplexer.Connect(config)) using (var conn = ConnectionMultiplexer.Connect(config))
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
Assert.True(db.StringGet(key).IsNull); Assert.True(db.StringGet(key).IsNull);
db.StringSet(key, "abc"); db.StringSet(key, "abc", flags: CommandFlags.FireAndForget);
Assert.Equal("abc", db.StringGet(key)); Assert.Equal("abc", db.StringGet(key));
} }
} }
......
...@@ -105,7 +105,7 @@ public async Task ConnectToSSLServer(bool useSsl, bool specifyHost) ...@@ -105,7 +105,7 @@ public async Task ConnectToSSLServer(bool useSsl, bool specifyHost)
muxer.ConnectionFailed += OnConnectionFailed; muxer.ConnectionFailed += OnConnectionFailed;
muxer.InternalError += OnInternalError; muxer.InternalError += OnInternalError;
var db = muxer.GetDatabase(); var db = muxer.GetDatabase();
await db.PingAsync(); await db.PingAsync().ForAwait();
using (var file = File.Create("ssl-" + useSsl + "-" + specifyHost + ".zip")) using (var file = File.Create("ssl-" + useSsl + "-" + specifyHost + ".zip"))
{ {
muxer.ExportConfiguration(file); muxer.ExportConfiguration(file);
...@@ -114,13 +114,13 @@ public async Task ConnectToSSLServer(bool useSsl, bool specifyHost) ...@@ -114,13 +114,13 @@ public async Task ConnectToSSLServer(bool useSsl, bool specifyHost)
const int AsyncLoop = 2000; const int AsyncLoop = 2000;
// perf; async // perf; async
await db.KeyDeleteAsync(key); await db.KeyDeleteAsync(key).ForAwait();
var watch = Stopwatch.StartNew(); var watch = Stopwatch.StartNew();
for (int i = 0; i < AsyncLoop; i++) for (int i = 0; i < AsyncLoop; i++)
{ {
try try
{ {
await db.StringIncrementAsync(key, flags: CommandFlags.FireAndForget); await db.StringIncrementAsync(key, flags: CommandFlags.FireAndForget).ForAwait();
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -129,7 +129,7 @@ public async Task ConnectToSSLServer(bool useSsl, bool specifyHost) ...@@ -129,7 +129,7 @@ public async Task ConnectToSSLServer(bool useSsl, bool specifyHost)
} }
} }
// need to do this inside the timer to measure the TTLB // need to do this inside the timer to measure the TTLB
long value = (long)await db.StringGetAsync(key); long value = (long)await db.StringGetAsync(key).ForAwait();
watch.Stop(); watch.Stop();
Assert.Equal(AsyncLoop, value); Assert.Equal(AsyncLoop, value);
Log("F&F: {0} INCR, {1:###,##0}ms, {2} ops/s; final value: {3}", Log("F&F: {0} INCR, {1:###,##0}ms, {2} ops/s; final value: {3}",
...@@ -173,7 +173,6 @@ public void RedisLabsSSL() ...@@ -173,7 +173,6 @@ public void RedisLabsSSL()
Skip.IfNoConfig(nameof(TestConfig.Config.RedisLabsSslServer), TestConfig.Current.RedisLabsSslServer); Skip.IfNoConfig(nameof(TestConfig.Config.RedisLabsSslServer), TestConfig.Current.RedisLabsSslServer);
Skip.IfNoConfig(nameof(TestConfig.Config.RedisLabsPfxPath), TestConfig.Current.RedisLabsPfxPath); Skip.IfNoConfig(nameof(TestConfig.Config.RedisLabsPfxPath), TestConfig.Current.RedisLabsPfxPath);
var cert = new X509Certificate2(TestConfig.Current.RedisLabsPfxPath, ""); var cert = new X509Certificate2(TestConfig.Current.RedisLabsPfxPath, "");
Assert.NotNull(cert); Assert.NotNull(cert);
Writer.WriteLine("Thumbprint: " + cert.Thumbprint); Writer.WriteLine("Thumbprint: " + cert.Thumbprint);
...@@ -189,10 +188,8 @@ public void RedisLabsSSL() ...@@ -189,10 +188,8 @@ public void RedisLabsSSL()
"subscribe", "unsubscribe", "cluster" "subscribe", "unsubscribe", "cluster"
}, false) }, false)
}; };
options.TrustIssuer("redislabs_ca.pem");
options.TrustIssuer("redislabs_ca.pem");
if (!Directory.Exists(Me())) Directory.CreateDirectory(Me()); if (!Directory.Exists(Me())) Directory.CreateDirectory(Me());
#if LOGOUTPUT #if LOGOUTPUT
...@@ -207,10 +204,10 @@ public void RedisLabsSSL() ...@@ -207,10 +204,10 @@ public void RedisLabsSSL()
using (var conn = ConnectionMultiplexer.Connect(options)) using (var conn = ConnectionMultiplexer.Connect(options))
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
string s = db.StringGet(key); string s = db.StringGet(key);
Assert.Null(s); Assert.Null(s);
db.StringSet(key, "abc"); db.StringSet(key, "abc", flags: CommandFlags.FireAndForget);
s = db.StringGet(key); s = db.StringGet(key);
Assert.Equal("abc", s); Assert.Equal("abc", s);
...@@ -253,7 +250,7 @@ public void RedisLabsEnvironmentVariableClientCertificate(bool setEnv) ...@@ -253,7 +250,7 @@ public void RedisLabsEnvironmentVariableClientCertificate(bool setEnv)
"subscribe", "unsubscribe", "cluster" "subscribe", "unsubscribe", "cluster"
}, false) }, false)
}; };
if (!Directory.Exists(Me())) Directory.CreateDirectory(Me()); if (!Directory.Exists(Me())) Directory.CreateDirectory(Me());
#if LOGOUTPUT #if LOGOUTPUT
ConnectionMultiplexer.EchoPath = Me(); ConnectionMultiplexer.EchoPath = Me();
...@@ -265,7 +262,7 @@ public void RedisLabsEnvironmentVariableClientCertificate(bool setEnv) ...@@ -265,7 +262,7 @@ public void RedisLabsEnvironmentVariableClientCertificate(bool setEnv)
if (!setEnv) Assert.True(false, "Could not set environment"); if (!setEnv) Assert.True(false, "Could not set environment");
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
string s = db.StringGet(key); string s = db.StringGet(key);
Assert.Null(s); Assert.Null(s);
db.StringSet(key, "abc"); db.StringSet(key, "abc");
......
...@@ -183,11 +183,11 @@ public void SetScan(bool supported) ...@@ -183,11 +183,11 @@ public void SetScan(bool supported)
{ {
RedisKey key = Me(); RedisKey key = Me();
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.SetAdd(key, "a"); db.SetAdd(key, "a", CommandFlags.FireAndForget);
db.SetAdd(key, "b"); db.SetAdd(key, "b", CommandFlags.FireAndForget);
db.SetAdd(key, "c"); db.SetAdd(key, "c", CommandFlags.FireAndForget);
var arr = db.SetScan(key).ToArray(); var arr = db.SetScan(key).ToArray();
Assert.Equal(3, arr.Length); Assert.Equal(3, arr.Length);
Assert.True(arr.Contains("a"), "a"); Assert.True(arr.Contains("a"), "a");
...@@ -206,11 +206,11 @@ public void SortedSetScan(bool supported) ...@@ -206,11 +206,11 @@ public void SortedSetScan(bool supported)
{ {
RedisKey key = Me() + supported; RedisKey key = Me() + supported;
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.SortedSetAdd(key, "a", 1); db.SortedSetAdd(key, "a", 1, CommandFlags.FireAndForget);
db.SortedSetAdd(key, "b", 2); db.SortedSetAdd(key, "b", 2, CommandFlags.FireAndForget);
db.SortedSetAdd(key, "c", 3); db.SortedSetAdd(key, "c", 3, CommandFlags.FireAndForget);
var arr = db.SortedSetScan(key).ToArray(); var arr = db.SortedSetScan(key).ToArray();
Assert.Equal(3, arr.Length); Assert.Equal(3, arr.Length);
...@@ -274,11 +274,11 @@ public void HashScan(bool supported) ...@@ -274,11 +274,11 @@ public void HashScan(bool supported)
{ {
RedisKey key = Me(); RedisKey key = Me();
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
db.HashSet(key, "a", "1"); db.HashSet(key, "a", "1", flags: CommandFlags.FireAndForget);
db.HashSet(key, "b", "2"); db.HashSet(key, "b", "2", flags: CommandFlags.FireAndForget);
db.HashSet(key, "c", "3"); db.HashSet(key, "c", "3", flags: CommandFlags.FireAndForget);
var arr = db.HashScan(key).ToArray(); var arr = db.HashScan(key).ToArray();
Assert.Equal(3, arr.Length); Assert.Equal(3, arr.Length);
...@@ -315,7 +315,7 @@ public void HashScanLarge(int pageSize) ...@@ -315,7 +315,7 @@ public void HashScanLarge(int pageSize)
{ {
RedisKey key = Me() + pageSize; RedisKey key = Me() + pageSize;
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
for (int i = 0; i < 2000; i++) for (int i = 0; i < 2000; i++)
db.HashSet(key, "k" + i, "v" + i, flags: CommandFlags.FireAndForget); db.HashSet(key, "k" + i, "v" + i, flags: CommandFlags.FireAndForget);
...@@ -342,14 +342,14 @@ public void HashScanThresholds() ...@@ -342,14 +342,14 @@ public void HashScanThresholds()
private bool GotCursors(ConnectionMultiplexer conn, RedisKey key, int count) private bool GotCursors(ConnectionMultiplexer conn, RedisKey key, int count)
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
var entries = new HashEntry[count]; var entries = new HashEntry[count];
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
{ {
entries[i] = new HashEntry("Item:" + i, i); entries[i] = new HashEntry("Item:" + i, i);
} }
db.HashSet(key, entries); db.HashSet(key, entries, CommandFlags.FireAndForget);
var found = false; var found = false;
var response = db.HashScan(key); var response = db.HashScan(key);
...@@ -375,7 +375,7 @@ public void SetScanLarge(int pageSize) ...@@ -375,7 +375,7 @@ public void SetScanLarge(int pageSize)
{ {
RedisKey key = Me() + pageSize; RedisKey key = Me() + pageSize;
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
for (int i = 0; i < 2000; i++) for (int i = 0; i < 2000; i++)
db.SetAdd(key, "s" + i, flags: CommandFlags.FireAndForget); db.SetAdd(key, "s" + i, flags: CommandFlags.FireAndForget);
...@@ -396,7 +396,7 @@ public void SortedSetScanLarge(int pageSize) ...@@ -396,7 +396,7 @@ public void SortedSetScanLarge(int pageSize)
{ {
RedisKey key = Me() + pageSize; RedisKey key = Me() + pageSize;
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
for (int i = 0; i < 2000; i++) for (int i = 0; i < 2000; i++)
db.SortedSetAdd(key, "z" + i, i, flags: CommandFlags.FireAndForget); db.SortedSetAdd(key, "z" + i, i, flags: CommandFlags.FireAndForget);
......
This diff is collapsed.
...@@ -19,15 +19,14 @@ public void SScan() ...@@ -19,15 +19,14 @@ public void SScan()
RedisKey key = Me(); RedisKey key = Me();
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(key);
int totalUnfiltered = 0, totalFiltered = 0; int totalUnfiltered = 0, totalFiltered = 0;
for (int i = 0; i < 1000; i++) for (int i = 1; i < 1001; i++)
{ {
db.SetAdd(key, i); db.SetAdd(key, i, CommandFlags.FireAndForget);
totalUnfiltered += i; totalUnfiltered += i;
if (i.ToString().Contains("3")) totalFiltered += i; if (i.ToString().Contains("3")) totalFiltered += i;
} }
var unfilteredActual = db.SetScan(key).Select(x => (int)x).Sum(); var unfilteredActual = db.SetScan(key).Select(x => (int)x).Sum();
Assert.Equal(totalUnfiltered, unfilteredActual); Assert.Equal(totalUnfiltered, unfilteredActual);
if (server.Features.Scan) if (server.Features.Scan)
...@@ -47,12 +46,12 @@ public async Task SetRemoveArgTests() ...@@ -47,12 +46,12 @@ public async Task SetRemoveArgTests()
var key = Me(); var key = Me();
RedisValue[] values = null; RedisValue[] values = null;
Assert.Throws<ArgumentNullException>(() => db.SetRemove(key, values, CommandFlags.HighPriority)); Assert.Throws<ArgumentNullException>(() => db.SetRemove(key, values));
await Assert.ThrowsAsync<ArgumentNullException>(async () => await db.SetRemoveAsync(key, values, CommandFlags.HighPriority).ForAwait()).ForAwait(); await Assert.ThrowsAsync<ArgumentNullException>(async () => await db.SetRemoveAsync(key, values).ForAwait()).ForAwait();
values = new RedisValue[0]; values = new RedisValue[0];
Assert.Equal(0, db.SetRemove(key, values, CommandFlags.HighPriority)); Assert.Equal(0, db.SetRemove(key, values));
Assert.Equal(0, await db.SetRemoveAsync(key, values, CommandFlags.HighPriority).ForAwait()); Assert.Equal(0, await db.SetRemoveAsync(key, values).ForAwait());
} }
} }
...@@ -66,10 +65,10 @@ public void SetPopMulti_Multi() ...@@ -66,10 +65,10 @@ public void SetPopMulti_Multi()
var db = conn.GetDatabase(); var db = conn.GetDatabase();
var key = Me(); var key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
for (int i = 1; i < 11; i++) for (int i = 1; i < 11; i++)
{ {
db.SetAdd(key, i); db.SetAddAsync(key, i, CommandFlags.FireAndForget);
} }
var random = db.SetPop(key); var random = db.SetPop(key);
...@@ -92,10 +91,10 @@ public void SetPopMulti_Single() ...@@ -92,10 +91,10 @@ public void SetPopMulti_Single()
var db = conn.GetDatabase(); var db = conn.GetDatabase();
var key = Me(); var key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
for (int i = 1; i < 11; i++) for (int i = 1; i < 11; i++)
{ {
db.SetAdd(key, i); db.SetAdd(key, i, CommandFlags.FireAndForget);
} }
var random = db.SetPop(key); var random = db.SetPop(key);
...@@ -121,10 +120,10 @@ public async Task SetPopMulti_Multi_Async() ...@@ -121,10 +120,10 @@ public async Task SetPopMulti_Multi_Async()
var db = conn.GetDatabase(); var db = conn.GetDatabase();
var key = Me(); var key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
for (int i = 1; i < 11; i++) for (int i = 1; i < 11; i++)
{ {
db.SetAdd(key, i); db.SetAdd(key, i, CommandFlags.FireAndForget);
} }
var random = await db.SetPopAsync(key).ForAwait(); var random = await db.SetPopAsync(key).ForAwait();
...@@ -148,10 +147,10 @@ public async Task SetPopMulti_Single_Async() ...@@ -148,10 +147,10 @@ public async Task SetPopMulti_Single_Async()
var db = conn.GetDatabase(); var db = conn.GetDatabase();
var key = Me(); var key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
for (int i = 1; i < 11; i++) for (int i = 1; i < 11; i++)
{ {
db.SetAdd(key, i); db.SetAdd(key, i, CommandFlags.FireAndForget);
} }
var random = await db.SetPopAsync(key).ForAwait(); var random = await db.SetPopAsync(key).ForAwait();
...@@ -175,10 +174,10 @@ public async Task SetPopMulti_Zero_Async() ...@@ -175,10 +174,10 @@ public async Task SetPopMulti_Zero_Async()
var db = conn.GetDatabase(); var db = conn.GetDatabase();
var key = Me(); var key = Me();
db.KeyDelete(key); db.KeyDelete(key, CommandFlags.FireAndForget);
for (int i = 1; i < 11; i++) for (int i = 1; i < 11; i++)
{ {
db.SetAdd(key, i); db.SetAdd(key, i, CommandFlags.FireAndForget);
} }
var t = db.SetPopAsync(key, count: 0); var t = db.SetPopAsync(key, count: 0);
......
This diff is collapsed.
...@@ -63,7 +63,7 @@ public void Dispose() ...@@ -63,7 +63,7 @@ public void Dispose()
#if VERBOSE #if VERBOSE
protected const int AsyncOpsQty = 100, SyncOpsQty = 10; protected const int AsyncOpsQty = 100, SyncOpsQty = 10;
#else #else
protected const int AsyncOpsQty = 100000, SyncOpsQty = 10000; protected const int AsyncOpsQty = 10000, SyncOpsQty = 10000;
#endif #endif
static TestBase() static TestBase()
......
...@@ -7,7 +7,7 @@ namespace StackExchange.Redis.Tests ...@@ -7,7 +7,7 @@ namespace StackExchange.Redis.Tests
{ {
public class WithKeyPrefixTests : TestBase public class WithKeyPrefixTests : TestBase
{ {
public WithKeyPrefixTests(ITestOutputHelper output) : base (output) { } public WithKeyPrefixTests(ITestOutputHelper output) : base(output) { }
[Fact] [Fact]
public void BlankPrefixYieldsSame_Bytes() public void BlankPrefixYieldsSame_Bytes()
...@@ -34,7 +34,8 @@ public void BlankPrefixYieldsSame_String() ...@@ -34,7 +34,8 @@ public void BlankPrefixYieldsSame_String()
[Fact] [Fact]
public void NullPrefixIsError_Bytes() public void NullPrefixIsError_Bytes()
{ {
Assert.Throws<ArgumentNullException>(() => { Assert.Throws<ArgumentNullException>(() =>
{
using (var conn = Create()) using (var conn = Create())
{ {
var raw = conn.GetDatabase(); var raw = conn.GetDatabase();
...@@ -46,7 +47,8 @@ public void NullPrefixIsError_Bytes() ...@@ -46,7 +47,8 @@ public void NullPrefixIsError_Bytes()
[Fact] [Fact]
public void NullPrefixIsError_String() public void NullPrefixIsError_String()
{ {
Assert.Throws<ArgumentNullException>(() => { Assert.Throws<ArgumentNullException>(() =>
{
using (var conn = Create()) using (var conn = Create())
{ {
var raw = conn.GetDatabase(); var raw = conn.GetDatabase();
...@@ -61,7 +63,8 @@ public void NullPrefixIsError_String() ...@@ -61,7 +63,8 @@ public void NullPrefixIsError_String()
[InlineData(null)] [InlineData(null)]
public void NullDatabaseIsError(string prefix) public void NullDatabaseIsError(string prefix)
{ {
Assert.Throws<ArgumentNullException>(() => { Assert.Throws<ArgumentNullException>(() =>
{
IDatabase raw = null; IDatabase raw = null;
var prefixed = raw.WithKeyPrefix(prefix); var prefixed = raw.WithKeyPrefix(prefix);
}); });
...@@ -70,7 +73,7 @@ public void NullDatabaseIsError(string prefix) ...@@ -70,7 +73,7 @@ public void NullDatabaseIsError(string prefix)
[Fact] [Fact]
public void BasicSmokeTest() public void BasicSmokeTest()
{ {
using(var conn = Create()) using (var conn = Create())
{ {
var raw = conn.GetDatabase(); var raw = conn.GetDatabase();
...@@ -82,11 +85,11 @@ public void BasicSmokeTest() ...@@ -82,11 +85,11 @@ public void BasicSmokeTest()
string s = Guid.NewGuid().ToString(), t = Guid.NewGuid().ToString(); string s = Guid.NewGuid().ToString(), t = Guid.NewGuid().ToString();
foo.StringSet(key, s); foo.StringSet(key, s, flags: CommandFlags.FireAndForget);
var val = (string)foo.StringGet(key); var val = (string)foo.StringGet(key);
Assert.Equal(s, val); // fooBasicSmokeTest Assert.Equal(s, val); // fooBasicSmokeTest
foobar.StringSet(key, t); foobar.StringSet(key, t, flags: CommandFlags.FireAndForget);
val = (string)foobar.StringGet(key); val = (string)foobar.StringGet(key);
Assert.Equal(t, val); // foobarBasicSmokeTest Assert.Equal(t, val); // foobarBasicSmokeTest
...@@ -104,18 +107,18 @@ public void BasicSmokeTest() ...@@ -104,18 +107,18 @@ public void BasicSmokeTest()
[Fact] [Fact]
public void ConditionTest() public void ConditionTest()
{ {
using(var conn = Create()) using (var conn = Create())
{ {
var raw = conn.GetDatabase(); var raw = conn.GetDatabase();
var prefix = Me() + ":"; var prefix = Me() + ":";
var foo = raw.WithKeyPrefix(prefix); var foo = raw.WithKeyPrefix(prefix);
raw.KeyDelete(prefix + "abc"); raw.KeyDelete(prefix + "abc", CommandFlags.FireAndForget);
raw.KeyDelete(prefix + "i"); raw.KeyDelete(prefix + "i", CommandFlags.FireAndForget);
// execute while key exists // execute while key exists
raw.StringSet(prefix + "abc", "def"); raw.StringSet(prefix + "abc", "def", flags: CommandFlags.FireAndForget);
var tran = foo.CreateTransaction(); var tran = foo.CreateTransaction();
tran.AddCondition(Condition.KeyExists("abc")); tran.AddCondition(Condition.KeyExists("abc"));
tran.StringIncrementAsync("i"); tran.StringIncrementAsync("i");
...@@ -125,7 +128,7 @@ public void ConditionTest() ...@@ -125,7 +128,7 @@ public void ConditionTest()
Assert.Equal(1, i); Assert.Equal(1, i);
// repeat without key // repeat without key
raw.KeyDelete(prefix + "abc"); raw.KeyDelete(prefix + "abc", CommandFlags.FireAndForget);
tran = foo.CreateTransaction(); tran = foo.CreateTransaction();
tran.AddCondition(Condition.KeyExists("abc")); tran.AddCondition(Condition.KeyExists("abc"));
tran.StringIncrementAsync("i"); tran.StringIncrementAsync("i");
......
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