Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilterRedis{T}"/> class.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="redisKey">The redisKey.</param>
 /// <param name="capacity">The capacity.</param>
 /// <param name="hashes">The hashes.</param>
 /// <param name="hashFunction">The hash function.</param>
 public FilterRedis(string name, IRedisBitOperate redisBitOperate, string redisKey, int capacity, int hashes, HashFunction hashFunction)
     : base(name, capacity, hashes, hashFunction)
 {
     if (string.IsNullOrWhiteSpace(redisKey))
     {
         throw new ArgumentException(nameof(redisKey));
     }
     _redisBitOperate = redisBitOperate ?? throw new ArgumentNullException(nameof(redisBitOperate));
     _redisKey        = redisKey;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilterRedis{T}"/> class.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="redisKey">The redisKey.</param>
 /// <param name="expectedElements">The expected elements.</param>
 /// <param name="errorRate">The error rate.</param>
 /// <param name="hashFunction">The hash function.</param>
 public FilterRedis(string name, IRedisBitOperate redisBitOperate, string redisKey, int expectedElements, double errorRate, HashFunction hashFunction)
     : base(name, expectedElements, errorRate, hashFunction)
 {
     if (string.IsNullOrWhiteSpace(redisKey))
     {
         throw new ArgumentException(nameof(redisKey));
     }
     _redisBitOperate = redisBitOperate ?? throw new ArgumentNullException(nameof(redisBitOperate));
     _redisKey        = redisKey;
 }
 /// <summary>
 /// Creates a BloomFilter Redis for the specified expected element
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="redisKey">The redis key.</param>
 /// <param name="expectedElements">The expected elements.</param>
 /// <param name="errorRate">The error rate.</param>
 /// <param name="hashFunction">The hash function.</param>
 /// <returns></returns>
 public static Filter <T> Build <T>(IRedisBitOperate redisBitOperate, string redisKey, int expectedElements, double errorRate, HashFunction hashFunction)
 {
     return(new FilterRedis <T>(redisBitOperate, redisKey, expectedElements, errorRate, hashFunction));
 }
 /// <summary>
 /// Creates a BloomFilter Redis for the specified expected element
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="redisKey">The redis key.</param>
 /// <param name="expectedElements">The expected elements.</param>
 /// <returns></returns>
 public static Filter <T> Build <T>(IRedisBitOperate redisBitOperate, string redisKey, int expectedElements)
 {
     return(Build <T>(redisBitOperate, redisKey, expectedElements, 0.01, HashFunctions[HashMethod.Murmur3KirschMitzenmacher]));
 }
 /// <summary>
 /// Creates a BloomFilter Redis for the specified expected element
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="redisKey">The redis key.</param>
 /// <param name="expectedElements">The expected elements.</param>
 /// <param name="hashFunction">The hash function.</param>
 /// <returns></returns>
 public static Filter <T> Build <T>(IRedisBitOperate redisBitOperate, string redisKey, int expectedElements, HashFunction hashFunction)
 {
     return(Build <T>(redisBitOperate, redisKey, expectedElements, 0.01, hashFunction));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilterRedis"/> class.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="redisKey">The name.</param>
 /// <param name="capacity">The capacity.</param>
 /// <param name="hashes">The hashes.</param>
 /// <param name="hashFunction">The hash function.</param>
 public FilterRedis(string name, IRedisBitOperate redisBitOperate, string redisKey, int capacity, int hashes, HashFunction hashFunction)
     : base(name, redisBitOperate, redisKey, capacity, hashes, hashFunction)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilterRedis"/> class.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="redisKey">The name.</param>
 /// <param name="expectedElements">The expected elements.</param>
 /// <param name="errorRate">The error rate.</param>
 /// <param name="hashFunction">The hash function.</param>
 public FilterRedis(string name, IRedisBitOperate redisBitOperate, string redisKey, int expectedElements, double errorRate, HashFunction hashFunction)
     : base(name, redisBitOperate, redisKey, expectedElements, errorRate, hashFunction)
 {
 }
Ejemplo n.º 8
0
 public static Filter <T> Build <T>(IRedisBitOperate redisBitOperate, string redisKey, int expectedElements, double errorRate, HashFunction hashFunction, string name = BloomFilterConstValue.DefaultRedisName)
 {
     return(new FilterRedis <T>(name, redisBitOperate, redisKey, expectedElements, errorRate, hashFunction));
 }
Ejemplo n.º 9
0
 public static Filter <T> Build <T>(IRedisBitOperate redisBitOperate, string redisKey, int expectedElements, string name = BloomFilterConstValue.DefaultRedisName)
 {
     return(Build <T>(redisBitOperate, redisKey, expectedElements, 0.01, HashFunction.Functions[HashMethod.Murmur3KirschMitzenmacher], name));
 }
Ejemplo n.º 10
0
 public static Filter <T> Build <T>(IRedisBitOperate redisBitOperate, string redisKey, int expectedElements, HashFunction hashFunction, string name = BloomFilterConstValue.DefaultRedisName)
 {
     return(Build <T>(redisBitOperate, redisKey, expectedElements, 0.01, hashFunction, name));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Creates a BloomFilter Redis for the specified expected element
 /// </summary>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="redisKey">The redis key.</param>
 /// <param name="expectedElements">The expected elements.</param>
 /// <param name="errorRate">The error rate.</param>
 /// <param name="hashMethod">The hash method.</param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static IBloomFilter Build(IRedisBitOperate redisBitOperate, string redisKey, int expectedElements, double errorRate, HashMethod hashMethod, string name = BloomFilterConstValue.DefaultRedisName)
 {
     return(new FilterRedis(name, redisBitOperate, redisKey, expectedElements, errorRate, HashFunction.Functions[hashMethod]));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates a BloomFilter Redis for the specified expected element
 /// </summary>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="redisKey">The redis key.</param>
 /// <param name="expectedElements">The expected elements.</param>
 /// <param name="hashMethod">The hash method.</param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static IBloomFilter Build(IRedisBitOperate redisBitOperate, string redisKey, int expectedElements, HashMethod hashMethod, string name = BloomFilterConstValue.DefaultRedisName)
 {
     return(Build(redisBitOperate, redisKey, expectedElements, 0.01, hashMethod, name));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilterRedis{T}"/> class.
 /// </summary>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="name">The name.</param>
 /// <param name="capacity">The capacity.</param>
 /// <param name="hashes">The hashes.</param>
 /// <param name="hashFunction">The hash function.</param>
 public FilterRedis(IRedisBitOperate redisBitOperate, string name, int capacity, int hashes, HashFunction hashFunction)
     : base(capacity, hashes, hashFunction)
 {
     _redisBitOperate = redisBitOperate;
     _name            = name;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilterRedis{T}"/> class.
 /// </summary>
 /// <param name="redisBitOperate">The redis bit operate.</param>
 /// <param name="name">The name.</param>
 /// <param name="expectedElements">The expected elements.</param>
 /// <param name="errorRate">The error rate.</param>
 /// <param name="hashFunction">The hash function.</param>
 public FilterRedis(IRedisBitOperate redisBitOperate, string name, int expectedElements, double errorRate, HashFunction hashFunction)
     : base(expectedElements, errorRate, hashFunction)
 {
     _redisBitOperate = redisBitOperate;
     _name            = name;
 }