https://github.com/imega/gomemcache-selector
Memcache consistent hash portable for Go. Exploring consistent hashing in Go.
https://github.com/imega/gomemcache-selector
consistent-hashing ketama memcache php-memcached
Last synced: 2 months ago
JSON representation
Memcache consistent hash portable for Go. Exploring consistent hashing in Go.
- Host: GitHub
- URL: https://github.com/imega/gomemcache-selector
- Owner: iMega
- License: apache-2.0
- Created: 2021-06-10T09:49:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-15T09:40:17.000Z (over 4 years ago)
- Last Synced: 2025-02-12T23:46:14.950Z (10 months ago)
- Topics: consistent-hashing, ketama, memcache, php-memcached
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
This contains implementation of the consistent hash for memcache
(client available at https://github.com/bradfitz/gomemcache/).
It was written using and for the Go programming language.
- [Memcache consistent hash portable for Go](https://github.com/iMega/gomemcache-selector/blob/main/php-memcache/selector.go)
- [Memcache consistent hash](https://github.com/php/pecl-caching-memcache/blob/master/memcache_consistent_hash.c)
## Using
```
$ go get github.com/imega/gomemcache-selector/php-memcache
```
## Example
```
import (
"github.com/bradfitz/gomemcache/memcache"
"github.com/imega/gomemcache-selector/php-memcache"
)
func main() {
selector := phpmemcache.New("10.0.0.1:11211", "10.0.0.2:11211", "10.0.0.3:11212")
mc := memcache.NewFromSelector(selector)
mc.Set(&memcache.Item{Key: "foo", Value: []byte("my value")})
it, err := mc.Get("foo")
...
}
```
## Reference
- [Memcache client library for the Go](https://github.com/bradfitz/gomemcache)
- [A gomemcache ServerSelector using the ketama selection algorithm ](https://github.com/rckclmbr/goketama)
- [Consistent Hashing: Algorithmic Tradeoffs - Damian Gryski](https://dgryski.medium.com/consistent-hashing-algorithmic-tradeoffs-ef6b8e2fcae8)
- [Ketama implementation compatible with Algorithm::ConsistentHash::Ketama](github.com/dgryski/go-ketama)
- [libketama-style consistent hashing in Go](https://github.com/ngerakines/ketama)