{"id":34146420,"url":"https://github.com/nihankhan/gomcache","last_synced_at":"2026-03-12T06:38:27.967Z","repository":{"id":252894917,"uuid":"840468612","full_name":"nihankhan/gomcache","owner":"nihankhan","description":"Go Memcached client library #golang ","archived":false,"fork":false,"pushed_at":"2024-12-08T08:13:13.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-17T17:39:44.702Z","etag":null,"topics":["golang","memcache","memcached","memcached-client"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nihankhan.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}},"created_at":"2024-08-09T19:23:54.000Z","updated_at":"2024-12-08T08:13:16.000Z","dependencies_parsed_at":"2024-09-09T09:12:03.321Z","dependency_job_id":"38cc9ed0-fe70-4da3-8779-497de4526937","html_url":"https://github.com/nihankhan/gomcache","commit_stats":null,"previous_names":["nihankhan/gomcache"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nihankhan/gomcache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihankhan%2Fgomcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihankhan%2Fgomcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihankhan%2Fgomcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihankhan%2Fgomcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nihankhan","download_url":"https://codeload.github.com/nihankhan/gomcache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihankhan%2Fgomcache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30417514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T04:41:02.746Z","status":"ssl_error","status_checked_at":"2026-03-12T04:40:12.571Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang","memcache","memcached","memcached-client"],"created_at":"2025-12-15T04:03:28.715Z","updated_at":"2026-03-12T06:38:27.960Z","avatar_url":"https://github.com/nihankhan.png","language":"Go","readme":"# gomcache\n\n`gomcache` is a Go library for interacting with Memcached servers using both TCP and UDP protocols. It provides a robust and simple client for performing standard Memcached operations such as setting, getting, deleting cache items, and checking server availability with high-level concurrency support.\n\n## Features\n\n- **TCP and UDP Support**: Choose between TCP or UDP protocols for communication with Memcached servers.\n- **Simple and Intuitive API**: Easy-to-use methods for setting, getting, deleting cache items, and checking server availability with the Ping method.\n- **High-Level Concurrency**: Thread-safe operations with built-in concurrency management for high-performance applications.\n- **Error Handling**: Robust error handling for network and protocol errors, ensuring reliable interactions with Memcached servers.\n\n## Installation\n\nTo use `gomcache` in your Go project, you need to install it using `go get`. Open your terminal and run:\n\n```bash\ngo get github.com/nihankhan/gomcache\n```\n\n## Usage\n\nHere's a quick guide on how to use the `gomcache` library in your Go application:\n\n### Import the Package\n\n```go\nimport \"github.com/nihankhan/gomcache\"\n```\n\n### Create a New Client\n\nCreate a new `Client` instance with the addresses of your Memcached servers:\n\n```go\nclient, err := gomcache.NewClient([]string{\"localhost:11211\"}, true) // If false disable UDP or true Enable UDP\nif err != nil {\n    log.Fatalf(\"failed to create client: %v\", err)\n}\n```\n\n### Set an Item\n\nUse the `Set` method to add or update an item in the cache:\n\n```go\nitem := \u0026gomcache.Item{\n    Key:   \"foo\",\n    Value: []byte(\"bar\"),\n    Flags: 0,\n    Expiration: 3600, // in seconds\n}\n\nerr := client.Set(item)\nif err != nil {\n    log.Fatalf(\"failed to set item: %v\", err)\n}\n```\n\n### Get an Item\n\nUse the `Get` method to retrieve an item from the cache:\n\n```go\nitem, err := client.Get(\"foo\")\nif err != nil {\n    log.Fatalf(\"failed to get item: %v\", err)\n}\nfmt.Printf(\"Value: %s\\n\", item.Value)\n```\n\n### Delete an Item\n\nUse the `Delete` method to remove an item from the cache:\n\n```go\nerr := client.Delete(\"foo\")\nif err != nil {\n    log.Fatalf(\"failed to delete item: %v\", err)\n}\n```\n\n### Ping the Server\n\nUse the `Ping` method to check if the server is responsive:\n\n```go\nerr := client.Ping(\"version\\r\\n\")\nif err != nil {\n    log.Fatalf(\"server is not responding: %v\", err)\n} else {\n    fmt.Println(\"Server is responsive\")\n}\n```\n\n## Testing\n\nTo run tests for `gomcache`, use the `go test` command:\n\n```bash\ngo test -v ./...\n```\n\n## Benchmark\n\nHere is the benchmark performance data for `gomcache`:\n\n| Benchmark                          | Operations per Second | Average Latency   | Memory Usage    | Allocations      |\n|-------------------------------------|-----------------------|-------------------|-----------------|------------------|\n| **Single Set/Get**                  | 12,470                | 83,486 ns/op      | 96,488 B/op     | 50 allocs/op     |\n| **Concurrent Set/Get (100 workers)**| 1 billion             | \u003c 0.0000600 ns/op | 0 B/op           | 0 allocs/op      |\n\n\n## Contribution\n\nContributions are welcome! If you have any ideas, improvements, or bug fixes, please open an issue or submit a pull request on the [GitHub repository](https://github.com/nihankhan/gomcache).\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## Contact\n\nFor any questions or feedback, please contact [Nihan Khan](mailto:nihan.khan@outlook.com).\n\n---\n\nEnjoy using `gomcache` and happy coding!\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnihankhan%2Fgomcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnihankhan%2Fgomcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnihankhan%2Fgomcache/lists"}