Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 11a5a75

Browse files
committed
Revert SetEntry to use older 2.4 SetEx method
1 parent 9a94fcc commit 11a5a75

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/ServiceStack.Redis/RedisClient.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,17 @@ public void SetEntry(string key, string value)
124124

125125
public void SetEntry(string key, string value, TimeSpan expireIn)
126126
{
127-
var bytesValue = value != null ? value.ToUtf8Bytes() : null;
127+
var bytesValue = value != null
128+
? value.ToUtf8Bytes()
129+
: null;
128130

129-
if (expireIn.Milliseconds > 0)
130-
base.Set(key, bytesValue, 0, (long)expireIn.TotalMilliseconds);
131-
else
132-
base.Set(key, bytesValue, (int)expireIn.TotalSeconds, 0);
131+
SetEx(key, (int)expireIn.TotalSeconds, bytesValue);
132+
133+
//New in 2.6.x - TODO change when 2.6 is most popular
134+
//if (expireIn.Milliseconds > 0)
135+
// base.Set(key, bytesValue, 0, (long)expireIn.TotalMilliseconds);
136+
//else
137+
// base.Set(key, bytesValue, (int)expireIn.TotalSeconds, 0);
133138
}
134139

135140
public void SetEntryIfExists(string key, string value, TimeSpan expireIn)

0 commit comments

Comments
 (0)