https://github.com/tg123/consistentsharp
Consistent hash for dotnet core. port from go version https://github.com/stathat/consistent
https://github.com/tg123/consistentsharp
consistent-hashing dotnet-core
Last synced: 3 months ago
JSON representation
Consistent hash for dotnet core. port from go version https://github.com/stathat/consistent
- Host: GitHub
- URL: https://github.com/tg123/consistentsharp
- Owner: tg123
- License: mit
- Created: 2016-05-02T16:14:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-03-12T12:49:32.000Z (over 5 years ago)
- Last Synced: 2024-12-01T00:29:10.992Z (11 months ago)
- Topics: consistent-hashing, dotnet-core
- Language: C#
- Homepage: https://www.nuget.org/packages/ConsistentSharp/
- Size: 34.2 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ConsistentSharp
Port https://github.com/stathat/consistent into C### Install
[](https://badge.fury.io/nu/ConsistentSharp)
```
Install-Package ConsistentSharp
```## Usage
```
var c = new ConsistentHash();c.Add("cacheA");
c.Add("cacheB");
c.Add("cacheC");var users = new[] {"user_mcnulty", "user_bunk", "user_omar", "user_bunny", "user_stringer"};
Console.WriteLine(c.Get("user_mcnulty")); // cacheA
c.Add("cacheD");
c.Add("cacheE");
Console.WriteLine(c.Get("user_mcnulty")); // cacheEc.Remove("cacheD");
c.Remove("cacheE");
Console.WriteLine(c.Get("user_mcnulty")); // cacheAc.Remove("cacheC");
Console.WriteLine(c.Get("user_mcnulty")); // cacheA
```