{"id":27947876,"url":"https://github.com/yeqown/memcached","last_synced_at":"2025-08-12T05:09:55.029Z","repository":{"id":276457893,"uuid":"929346753","full_name":"yeqown/memcached","owner":"yeqown","description":"A memcached Go client package  supports cluster usage、meta text protocol and basic text protocol.","archived":false,"fork":false,"pushed_at":"2025-07-28T06:34:07.000Z","size":541,"stargazers_count":5,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-28T07:34:19.978Z","etag":null,"topics":["cli","cluster","golang","memcached","metadata","package","rendezvous-hashing","sasl"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yeqown.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-08T10:34:35.000Z","updated_at":"2025-07-28T06:32:33.000Z","dependencies_parsed_at":"2025-02-26T06:21:11.632Z","dependency_job_id":"872ab123-cf19-40c9-9fae-9c04ab9ede7b","html_url":"https://github.com/yeqown/memcached","commit_stats":null,"previous_names":["yeqown/memcached-gui","yeqown/memcached"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/yeqown/memcached","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeqown%2Fmemcached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeqown%2Fmemcached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeqown%2Fmemcached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeqown%2Fmemcached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yeqown","download_url":"https://codeload.github.com/yeqown/memcached/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeqown%2Fmemcached/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270005591,"owners_count":24510939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","cluster","golang","memcached","metadata","package","rendezvous-hashing","sasl"],"created_at":"2025-05-07T14:38:21.668Z","updated_at":"2025-08-12T05:09:54.986Z","avatar_url":"https://github.com/yeqown.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./docs/memcached-cli.svg\"\u003e\n\n## Memcached\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/yeqown/memcached.svg)](https://pkg.go.dev/github.com/yeqown/memcached) [![Go Report Card](https://goreportcard.com/badge/github.com/yeqown/memcached)](https://goreportcard.com/report/github.com/yeqown/memcached)  [![GitHub license](https://img.shields.io/github/license/yeqown/memcached)](https://github.com/yeqown/memcached/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/yeqown/memcached.svg)](https://github.com/yeqown/memcached/releases) [![GitHub stars](https://img.shields.io/github/stars/yeqown/memcached.svg)](https://github.com/yeqown/memcached/stargazers) [![GitHub issues](https://img.shields.io/github/issues/yeqown/memcached.svg)](https://github.com/yeqown/memcached/issues) [![Build Status](https://github.com/yeqown/memcached/workflows/Go/badge.svg)](https://github.com/yeqown/memcached/actions) [![codecov](https://codecov.io/gh/yeqown/memcached/branch/master/graph/badge.svg)](https://codecov.io/gh/yeqown/memcached)\n\nThis is a golang package for [Memcached](https://memcached.org/). It is a simple and easy to use package.\n\n### Features\n\n- [x] Completed Memcached text protocol, includes meta text protocol.\n- [ ] Integrated serialization and deserialization function\n- [x] Cluster support, multiple hash algorithm support, include: crc32, murmur3, redezvous and also custom hash algorithm.\n- [x] Fully connection pool features support.\n- [x] CLI tool support.\n- [x] \u003cdel\u003eSASL support.\u003c/del\u003e\n- [x] support TCP、UDP and Unix domain socket transport.\n\n### Installation\n\n```bash\ngo get github.com/yeqown/memcached@latest\n```\n\nOr you can install the CLI binary by running:\n\n```bash\ngo install github.com/yeqown/memcached/cmd/memcached-cli@latest\n```\n\nMore `memcached-cli` usage could be found in [CLI](./cmd/memcached-cli/README.md).\n\n### Usage\n\nThere is a simple example to show how to use this package. More examples could be found in the [example](./example) directory.\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"time\"\n\n    \"github.com/yeqown/memcached\"\n)\n\nfunc main() {\n\t// 1. build client\n\t// addrs is a string, if you have multiple memcached servers, you can use comma to separate them.\n\t// e.g. \"localhost:11211,localhost:11212,localhost:11213\"\n\taddrs := \"localhost:11211\"\n\n\t// client support options, you can set the options to client.\n\t// e.g. memcached.New(addrs, memcached.WithDialTimeout(5*time.Second))\n\tclient, err := memcached.New(addrs)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// 2. use client\n\t// now, you can use the client API to finish your work.\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tversion, err := client.Version(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tprintln(\"Version: \", version)\n\n\tif err = client.Set(ctx, \"key\", []byte(\"value\"), 0, 0); err != nil {\n\t\tpanic(err)\n\t}\n\tif err = client.Set(ctx, \"key2\", []byte(\"value2\"), 0, 0); err != nil {\n\t\tpanic(err)\n\t}\n\n\titems, err := client.Gets(ctx, \"key\", \"key2\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, item := range items {\n\t\tprintln(\"key: \", item.Key, \" value: \", string(item.Value))\n\t}\n}\n```\n\n### Support Commands\n\nNow, we have implemented some commands, and we will implement more commands in the future.\n\n| Command        | Status | API Usage                                                                                                           | Description                                                       |\n|----------------|--------|---------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|\n| ----           | -----  | STORAGE COMMANDS                                                                                                    | ---                                                               |\n| Set            | ✅      | `Set(ctx context.Context, key string, value []byte, flags uint32, expiry time.Duration) error`                      | Set a key-value pair to memcached                                 |\n| Add            | ✅      | `Add(ctx context.Context, key string, value []byte, flags uint32, expiry time.Duration) error`                      | Add a key-value pair to memcached                                 |\n| Replace        | ✅      | `Replace(ctx context.Context, key string, value []byte, flags uint32, expiry time.Duration) error`                  | Replace a key-value pair to memcached                             |\n| Append         | ✅      | `Append(ctx context.Context, key string, value []byte, flags uint32, expiry time.Duration) error`                   | Append a value to the key                                         |\n| Prepend        | ✅      | `Prepend(ctx context.Context, key string, value []byte, flags uint32, expiry time.Duration) error`                  | Prepend a value to the key                                        |\n| Cas            | ✅      | `Cas(ctx context.Context, key string, value []byte, flags uint32, expiry time.Duration, cas uint64) error`          | Compare and set a key-value pair to memcached                     |\n| ----           | -----  | RETRIEVAL COMMANDS                                                                                                  | ---                                                               |\n| Gets           | ✅      | `Gets(ctx context.Context, keys ...string) ([]*Item, error)`                                                        | Get a value by key from memcached with cas value                  |\n| Get            | ✅      | `Get(ctx context.Context, key string) (*Item, error)`                                                               | Get a value by key from memcached                                 |\n| GetAndTouch    | ✅      | `GetAndTouch(ctx context.Context, expiry uint32, key string) (*Item, error)`                                        | Get a value by key from memcached and touch the key's expire time |\n| GetAndTouches  | ✅      | `GetAndTouches(ctx context.Context, expiry uint32, keys ...string) ([]*Item, error)`                                | Get a value by key from memcached and touch the key's expire time |\n| -----          | -----  | OTHER COMMANDS                                                                                                      | ---                                                               |\n| Delete         | ✅      | `Delete(ctx context.Context, key string) error`                                                                     | Delete a key-value pair from memcached                            |\n| Incr           | ✅      | `Incr(ctx context.Context, key string, delta uint64) (uint64, error)`                                               | Increment a key's value                                           |\n| Decr           | ✅      | `Decr(ctx context.Context, key string, delta uint64) (uint64, error)`                                               | Decrement a key's value                                           |\n| Touch          | ✅      | `Touch(ctx context.Context, key string, expiry uint32) error`                                                       | Touch a key's expire time                                         |\n| MetaGet        | ✅      | `MetaGet(ctx context.Context, key []byte, options ...MetaGetOption) (*MetaItem, error)`                             | Get a key's meta information                                      |\n| MetaSet        | ✅      | `MetaSet(ctx context.Context, key, value []byte, options ...MetaSetOption) (*MetaItem, error)`                      | Set a key's meta information                                      |\n| MetaDelete     | ✅      | `MetaDelete(ctx context.Context, key []byte, options ...MetaDeleteOption) (*MetaItem, error)`                       | Delete a key's meta information                                   |\n| MetaArithmetic | ✅      | `MetaArithmetic(ctx context.Context, key []byte, delta uint64, options ...MetaArithmeticOption) (*MetaItem, error)` | Arithmetic a key's meta information                               |\n| MetaDebug      | ✅      | `MetaDebug(ctx context.Context, key []byte, options ...MetaDebugOption) (*MetaItemDebug, error)`                    | Debug a key's meta information                                    |\n| MetaNoop       | ✅      | `MetaNoop(ctx context.Context) error`                                                                               | Noop a key's meta information                                     |\n| Version        | ✅      | `Version(ctx context.Context) (string, error)`                                                                      | Get memcached server version                                      |\n| FlushAll       | ✅      | `FlushAll(ctx context.Context) error`                                                                               | Flush all keys in memcached server                                |\n\n### Development Guide\n\n#### Prerequisites\n\n- Go 1.21 or higher\n- Python (for pre-commit hooks) or just `brew install pre-commit` on MacOS\n- Docker (for running memcached in tests)\n\n#### Setting up development environment\n\n1. Clone the repository:\n    ```bash\n    git clone https://github.com/yeqown/memcached.git\n    cd memcached\n    ```\n2. Install pre-commit hooks:\n    ```bash\n    pip install pre-commit\n    # or MacOS\n    # brew install pre-commit\n\n    pre-commit install\n    ```\n3. Install golangci-lint:\n    ```bash\n    go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest\n    ```\n\n#### Running Tests\n\n```bash\ngo test -v -race -coverprofile=coverage.txt -covermode=atomic ./...\n```\n\n#### Code Style\n\nThis project follows the standard Go code style guidelines and uses golangci-lint for additional checks. The configuration can be found in [.golangci.yml](./.golangci.yml).\n\nKey points:\n- Follow Go standard formatting (enforced by gofmt )\n- Ensure all code is properly tested\n- Write clear commit messages\n- Document public APIs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeqown%2Fmemcached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyeqown%2Fmemcached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeqown%2Fmemcached/lists"}