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

Commit 218439b

Browse files
committed
Keep Set() to match existing interface
1 parent 6e105a1 commit 218439b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/ServiceStack.Redis/RedisNativeClient.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,18 @@ public long StrLen(string key)
315315
return SendExpectLong(Commands.StrLen, key.ToUtf8Bytes());
316316
}
317317

318+
public void Set(string key, byte[] value)
319+
{
320+
if (key == null)
321+
throw new ArgumentNullException("key");
322+
value = value ?? new byte[0];
323+
324+
if (value.Length > OneGb)
325+
throw new ArgumentException("value exceeds 1G", "value");
326+
327+
SendExpectSuccess(Commands.Set, key.ToUtf8Bytes(), value);
328+
}
329+
318330
public void Set(string key, byte[] value, int? expirySeconds = null, long? expiryMs = null, bool? exists = null)
319331
{
320332
if (key == null)
@@ -340,10 +352,12 @@ public void Set(string key, byte[] value, int? expirySeconds = null, long? expir
340352
{
341353
SendExpectSuccess(Commands.Set, key.ToUtf8Bytes(), value, exists.Value ? Commands.SetIfKeyExists : Commands.SetIfKeyDoesNotExist);
342354
}
343-
else if (exists.HasValue && expirySeconds.HasValue) {
355+
else if (exists.HasValue && expirySeconds.HasValue)
356+
{
344357
SendExpectSuccess(Commands.Set, key.ToUtf8Bytes(), value, exists.Value ? Commands.SetIfKeyExists : Commands.SetIfKeyDoesNotExist, Commands.ExpireInSeconds, expirySeconds.Value.ToUtf8Bytes());
345358
}
346-
else if (exists.HasValue && expiryMs.HasValue) {
359+
else if (exists.HasValue && expiryMs.HasValue)
360+
{
347361
SendExpectSuccess(Commands.Set, key.ToUtf8Bytes(), value, exists.Value ? Commands.SetIfKeyExists : Commands.SetIfKeyDoesNotExist, Commands.ExpireInMilliseconds, expiryMs.Value.ToUtf8Bytes());
348362
}
349363
}

0 commit comments

Comments
 (0)