ConsistentHash<T>
Assembly: ServiceStack.Redis.dll
View Source
Declaration
public class ConsistentHash<T>
Methods
GetTarget(String)
View Source
Declaration
public T GetTarget(string key)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | key |
AddTarget(T, Int32)
Adds a node and maps points across the circle
View Source
Declaration
public void AddTarget(T node, int weight)
Parameters
Type | Name | Description |
---|---|---|
<T> | node | node to add |
|
| System.Int32
| weight | An arbitrary number, specifies how often it occurs relative to other targets.
|
ModifiedBinarySearch(UInt64[], UInt64)
A variation of Binary Search algorithm. Given a number, matches the next highest number from the sorted array. If a higher number does not exist, then the first number in the array is returned.
View Source
Declaration
public static ulong ModifiedBinarySearch(ulong[] sortedArray, ulong val)
Returns
System.UInt64
: next highest number
Parameters
Type | Name | Description |
---|---|---|
System.UInt64[] | sortedArray | a sorted array to perform the search |
|
| System.UInt64
| val | number to find the next highest number against
|
Md5Hash(String)
Given a key, generates an unsigned 64 bit hash code using MD5
View Source
Declaration
public static ulong Md5Hash(string key)
Returns
System.UInt64
Parameters
Type | Name |
---|---|
System.String | key |