@@ -315,6 +315,18 @@ public long StrLen(string key)
315
315
return SendExpectLong ( Commands . StrLen , key . ToUtf8Bytes ( ) ) ;
316
316
}
317
317
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
+
318
330
public void Set ( string key , byte [ ] value , int ? expirySeconds = null , long ? expiryMs = null , bool ? exists = null )
319
331
{
320
332
if ( key == null )
@@ -340,10 +352,12 @@ public void Set(string key, byte[] value, int? expirySeconds = null, long? expir
340
352
{
341
353
SendExpectSuccess ( Commands . Set , key . ToUtf8Bytes ( ) , value , exists . Value ? Commands . SetIfKeyExists : Commands . SetIfKeyDoesNotExist ) ;
342
354
}
343
- else if ( exists . HasValue && expirySeconds . HasValue ) {
355
+ else if ( exists . HasValue && expirySeconds . HasValue )
356
+ {
344
357
SendExpectSuccess ( Commands . Set , key . ToUtf8Bytes ( ) , value , exists . Value ? Commands . SetIfKeyExists : Commands . SetIfKeyDoesNotExist , Commands . ExpireInSeconds , expirySeconds . Value . ToUtf8Bytes ( ) ) ;
345
358
}
346
- else if ( exists . HasValue && expiryMs . HasValue ) {
359
+ else if ( exists . HasValue && expiryMs . HasValue )
360
+ {
347
361
SendExpectSuccess ( Commands . Set , key . ToUtf8Bytes ( ) , value , exists . Value ? Commands . SetIfKeyExists : Commands . SetIfKeyDoesNotExist , Commands . ExpireInMilliseconds , expiryMs . Value . ToUtf8Bytes ( ) ) ;
348
362
}
349
363
}
0 commit comments