You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SET EX NX does not set a string longer than expired, e.g. if the expired
string is "short" (length 5) and the new value is "longer" (length 6) then
the result is true as expected ~ the string is set, but the new string is
not actually stored, the key does not exist.
Steps to reproduce the bug
[Fact]publicvoidExistingExpired6379(){varredis= ConnectionMultiplexer.Connect("127.0.0.1:6379,SyncTimeout=999999");vardb= redis.GetDatabase();varkey="test:lock1";varvalue1="short";varvalue2="longer";varttl1= TimeSpan.FromMilliseconds(200);varttl2= TimeSpan.FromMinutes(1);// set expiring string "short" and let it expire
db.StringSet(key, value1, ttl1);
Thread.Sleep(ttl1*2);// set expiring string "longer" over expired "short" -> true ~ expectedboolok= db.StringSet(key, value2, ttl2, When.NotExists);
Assert.True(ok);// but the expected string does not exist, null is returned, assert failsstring?str= db.StringGet(key);
Assert.Equal(value2, str);}
Expected behavior
The above xunit test is supposed to pass (new string exists) but it fails (the string does not exist, although the operation returned true).
Note that the test passes is we use a shorter string as value2, e.g. "longe" instead of "longer".
Release version
1.0.35
IDE
Microsoft Visual Studio Community 2022 (64-bit) - 17.11.5
OS version
Windows 11
The text was updated successfully, but these errors were encountered:
Describe the bug
SET EX NX
does not set a string longer than expired, e.g. if the expiredstring is "short" (length 5) and the new value is "longer" (length 6) then
the result is
true
as expected ~ the string is set, but the new string isnot actually stored, the key does not exist.
Steps to reproduce the bug
Expected behavior
The above xunit test is supposed to pass (new string exists) but it fails (the string does not exist, although the operation returned
true
).Note that the test passes is we use a shorter string as
value2
, e.g. "longe" instead of "longer".Release version
1.0.35
IDE
Microsoft Visual Studio Community 2022 (64-bit) - 17.11.5
OS version
Windows 11
The text was updated successfully, but these errors were encountered: