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

Commit

Permalink
Add new Hyperlog commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Apr 13, 2014
1 parent 3bcb997 commit 7db48fb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ServiceStack.Redis/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public static class Commands
public readonly static byte[] Match = "MATCH".ToUtf8Bytes();
public readonly static byte[] Count = "COUNT".ToUtf8Bytes();

public readonly static byte[] PfAdd = "PFADD".ToUtf8Bytes();
public readonly static byte[] PfCount = "PFCOUNT".ToUtf8Bytes();
public readonly static byte[] PfMerge = "PFMERGE".ToUtf8Bytes();

public readonly static byte[] RPush = "RPUSH".ToUtf8Bytes();
public readonly static byte[] LPush = "LPUSH".ToUtf8Bytes();
public readonly static byte[] RPushX = "RPUSHX".ToUtf8Bytes();
Expand Down
31 changes: 31 additions & 0 deletions tests/ServiceStack.Redis.Tests/RedisHyperLogTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using NUnit.Framework;

namespace ServiceStack.Redis.Tests
{
[TestFixture, Explicit]
public class RedisHyperLogTests
: RedisClientTestsBase
{
[Test]
public void Can_Add_to_Hyperlog()
{
var redis = new RedisClient("10.0.0.64");
redis.FlushAll();

redis.AddToHyperLog("hyperlog", "a", "b", "c");
redis.AddToHyperLog("hyperlog", "c", "d");

var count = redis.CountHyperLog("hyperlog");

Assert.That(count, Is.EqualTo(4));

redis.AddToHyperLog("hyperlog2", "c", "d", "e", "f");

redis.MergeHyperLogs("hypermerge", "hyperlog", "hyperlog2");

var mergeCount = redis.CountHyperLog("hypermerge");

Assert.That(mergeCount, Is.EqualTo(6));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
<Compile Include="Generic\RedisTypedPipelineTests.cs" />
<Compile Include="RedisClientEvalTests.cs" />
<Compile Include="RedisClientsManagerExtensionsTests.cs" />
<Compile Include="RedisHyperLogTests.cs" />
<Compile Include="RedisPipelineCommonTests.cs" />
<Compile Include="RedisPipelineTests.cs" />
<Compile Include="Examples\BestPractice\IBlogRepository.cs" />
Expand Down

0 comments on commit 7db48fb

Please sign in to comment.