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

Commit dd28fb1

Browse files
committed
Add new Incr methods from v3
1 parent 423f686 commit dd28fb1

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/ServiceStack.Redis/RedisClient.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,16 @@ public long IncrementValueBy(string key, int count)
286286
return IncrBy(key, count);
287287
}
288288

289+
public long IncrementValueBy(string key, long count)
290+
{
291+
return IncrBy(key, count);
292+
}
293+
294+
public double IncrementValueBy(string key, double count)
295+
{
296+
return IncrByFloat(key, count);
297+
}
298+
289299
public long DecrementValue(string key)
290300
{
291301
return Decr(key);

src/ServiceStack.Redis/RedisClient_Hash.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public long IncrementValueInHash(string hashId, string key, long incrementBy)
8686
return base.HIncrby(hashId, key.ToUtf8Bytes(), incrementBy);
8787
}
8888

89+
public double IncrementValueInHash(string hashId, string key, double incrementBy)
90+
{
91+
return base.HIncrbyFloat(hashId, key.ToUtf8Bytes(), incrementBy);
92+
}
93+
8994
public string GetValueFromHash(string hashId, string key)
9095
{
9196
return base.HGet(hashId, key.ToUtf8Bytes()).FromUtf8Bytes();

src/ServiceStack.Redis/RedisNativeClient.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,19 @@ public long IncrBy(string key, int count)
503503
return SendExpectLong(Commands.IncrBy, key.ToUtf8Bytes(), count.ToUtf8Bytes());
504504
}
505505

506+
public long IncrBy(string key, long count)
507+
{
508+
if (key == null)
509+
throw new ArgumentNullException("key");
510+
return SendExpectLong(Commands.IncrBy, key.ToUtf8Bytes(), count.ToUtf8Bytes());
511+
}
512+
506513
public double IncrByFloat(string key, double incrBy)
507514
{
508515
if (key == null)
509516
throw new ArgumentNullException("key");
510517

511-
return SendExpectDouble(Commands.IncrBy, key.ToUtf8Bytes(), incrBy.ToUtf8Bytes());
518+
return SendExpectDouble(Commands.IncrByFloat, key.ToUtf8Bytes(), incrBy.ToUtf8Bytes());
512519
}
513520

514521
public long Decr(string key)

0 commit comments

Comments
 (0)