Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aliexpressru/gomemcached
A Binary Memcached client for Go with support for sharding using consistent hashing, along with SASL.
https://github.com/aliexpressru/gomemcached
consistent-hashing go golang memcached memcached-clients
Last synced: about 1 hour ago
JSON representation
A Binary Memcached client for Go with support for sharding using consistent hashing, along with SASL.
- Host: GitHub
- URL: https://github.com/aliexpressru/gomemcached
- Owner: aliexpressru
- License: mit
- Created: 2024-01-19T14:10:56.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-02-19T07:08:35.000Z (4 months ago)
- Last Synced: 2024-02-20T07:47:39.151Z (4 months ago)
- Topics: consistent-hashing, go, golang, memcached, memcached-clients
- Language: Go
- Homepage:
- Size: 458 KB
- Stars: 14
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-go - gomemcached - A binary Memcached client for Go with support for sharding using consistent hashing, along with SASL. (Database Drivers / NoSQL Database Drivers)
- awesome-go-with-stars - gomemcached - A binary Memcached client for Go with support for sharding using consistent hashing, along with SASL. (Database Drivers / NoSQL Database Drivers)
- awesome-go-stars - gomemcached(stars: 16) - A binary Memcached client for Go with support for sharding using consistent hashing, along with SASL. (Database Drivers / NoSQL Database Drivers)
- awesome-go-cn - gomemcached
- awesome-go - gomemcached - A binary Memcached client for Go with support for sharding using consistent hashing, along with SASL. (Database Drivers / NoSQL Database Drivers)
- awesome-go - gomemcached - A binary Memcached client for Go with support for sharding using consistent hashing, along with SASL. (Database Drivers / NoSQL Database Drivers)
README
# Gomemcached
---
[![License](https://img.shields.io/github/license/gogf/gf.svg?style=flat)](https://github.com/aliexpressru/gomemcached)
[![Tag](https://img.shields.io/github/v/tag/aliexpressru/gomemcached?color=%23ff8936&logo=fitbit)](https://github.com/aliexpressru/gomemcached/tags)
[![Godoc](https://godoc.org/github.com/aliexpressru/gomemcached?status.svg)](https://pkg.go.dev/github.com/aliexpressru/gomemcached)[![Gomemcached](https://goreportcard.com/badge/github.com/aliexpressru/gomemcached)](https://goreportcard.com/report/github.com/aliexpressru/gomemcached)
![Coverage](https://img.shields.io/badge/Coverage-91.0%25-brightgreen)[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go?tab=readme-ov-file#nosql-database-drivers)
___
`Gomemcached` is a Golang Memcached client designed to interact with multiple instances as shards. Implements sharding using a Consistent Hash.
___### Configuration
```yaml
- name: MEMCACHED_HEADLESS_SERVICE_ADDRESS
value: "my-memchached-service-headless.namespace.svc.cluster.local"
````MEMCACHED_HEADLESS_SERVICE_ADDRESS` groups all memcached instances by ip addresses using dns lookup.
Default Memcached port is `11211`, but you can also specify it in config.
```yaml
- name: MEMCACHED_PORT
value: "12345"
```For local run or if you have a static amount and setup of pods you can specify Servers (list separated by commas along with the port) manually instead of setting the
HeadlessServiceAddress:```yaml
- name: MEMCACHED_SERVERS
value: "127.0.0.1:11211,192.168.0.1:1234"
```___
### Usage
Initialization client and connected to memcached servers.
```go
mcl, err := memcached.InitFromEnv()
mustInit(err)
a.AddCloser(func () error {
mcl.CloseAllConns()
return nil
})
```
[More examples](examples/main.go)To use SASL specify option for InitFromEnv:
```go
memcached.InitFromEnv(memcached.WithAuthentication("", ""))
```Can use Options with InitFromEnv to customize the client to suit your needs. However, for basic use, it is recommended
to use the default client implementation.---
### Recommended Versions
This project is developed and tested with the following recommended versions:
- Go: 1.21 or higher
- [Download Go](https://golang.org/dl/)- Memcached: 1.6.9 or higher
- [Memcached Releases](https://memcached.org/downloads)---
### Dependencies
This project utilizes the following third-party libraries, each governed by the MIT License:
1. [gomemcache](https://github.com/bradfitz/gomemcache)
- Description: A Go client library for the memcached server.
- Used for: Primary client methods for interacting with the library.
- License: Apache License 2.02. [go-zero](https://github.com/zeromicro/go-zero)
- Description: A cloud-native Go microservices framework with cli tool for productivity.
- Used for: Implementation of Consistent Hash.
- License: MIT License3. [gomemcached](https://github.com/dustin/gomemcached)
- Description: A memcached binary protocol toolkit for go.
- Used for: Implementation of a binary client for Memcached.
- License: MIT LicensePlease review the respective license files in the linked repositories for more details.