本文整理汇总了C#中RedisClient.PFAdd方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.PFAdd方法的具体用法?C# RedisClient.PFAdd怎么用?C# RedisClient.PFAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedisClient
的用法示例。
在下文中一共展示了RedisClient.PFAdd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PfAddTest
public void PfAddTest()
{
using(var mock = new MockConnector("localhost", 9999, ":1\r\n"))
using(var redis = new RedisClient(mock))
{
Assert.True(redis.PFAdd("test", "test1", "test2"));
Assert.Equal("*4\r\n$5\r\nPFADD\r\n$4\r\ntest\r\n$5\r\ntest1\r\n$5\r\ntest2\r\n", mock.GetMessage());
}
this.RealCall(redis =>
{
Assert.True(redis.PFAdd("key1", "value1", "value2"));
});
}
示例2: PfCountTest
public void PfCountTest()
{
using(var mock = new MockConnector("localhost", 9999, ":2\r\n"))
using(var redis = new RedisClient(mock))
{
Assert.Equal(2, redis.PFCount("test1", "test2"));
Assert.Equal("*3\r\n$7\r\nPFCOUNT\r\n$5\r\ntest1\r\n$5\r\ntest2\r\n", mock.GetMessage());
}
this.RealCall(redis =>
{
Assert.True(redis.PFAdd("key1", "value1", "value2"));
Assert.True(redis.PFAdd("key2", "value1", "value3"));
Assert.Equal(3, redis.PFCount("key1", "key2"));
});
}
示例3: PfMergeTest
public void PfMergeTest()
{
using(var mock = new MockConnector("localhost", 9999, "+OK\r\n"))
using(var redis = new RedisClient(mock))
{
Assert.True(redis.PFMerge("destination", "source1", "source2"));
Assert.Equal("*4\r\n$7\r\nPFMERGE\r\n$11\r\ndestination\r\n$7\r\nsource1\r\n$7\r\nsource2\r\n", mock.GetMessage());
}
this.RealCall(redis =>
{
Assert.True(redis.PFAdd("key1", "value1", "value2"));
Assert.True(redis.PFAdd("key2", "value1", "value3"));
Assert.True(redis.PFMerge("key3", "key1", "key2"));
Assert.Equal(3, redis.PFCount("key3"));
});
}