Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
geata authored Dec 18, 2023
1 parent abf0cff commit f71b9a4
Showing 1 changed file with 7 additions and 32 deletions.
39 changes: 7 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,14 @@
## About

This is a memcache client library for the Go programming language
(http://golang.org/).
This is a fork of the https://github.com/bradfitz/gomemcache

## Example
## 🤷‍Why ami I doing this?
In the original repo, the MaxIdleConns only limit idle connections but not the concurrent connections to memcached. So you would have a large number of one-time connections in a moment when high concurrency. As is known to all, memcached connections couldn't close gracefully. There may be a large number of **CLOSE_WAIT** connections in your system.

Install with:

```shell
$ go get github.com/bradfitz/gomemcache/memcache
```
## What's new
* Limit maximum number of concurrent connections to memcached.
* Use go channel for connection pool.
* Keep each connection in pool alive.

Then use it like:

```go
import (
"github.com/bradfitz/gomemcache/memcache"
)

func main() {
mc := memcache.New("10.0.0.1:11211", "10.0.0.2:11211", "10.0.0.3:11212")
mc.Set(&memcache.Item{Key: "foo", Value: []byte("my value")})

it, err := mc.Get("foo")
...
}
```

## Full docs, see:

See https://pkg.go.dev/github.com/bradfitz/gomemcache/memcache

Or run:

```shell
$ godoc github.com/bradfitz/gomemcache/memcache
```

0 comments on commit f71b9a4

Please sign in to comment.