{"id":20168902,"url":"https://github.com/quangtung97/go-memcache","last_synced_at":"2025-04-10T02:08:10.092Z","repository":{"id":57647478,"uuid":"441145178","full_name":"QuangTung97/go-memcache","owner":"QuangTung97","description":"Go Memcached Client For Meta Commands","archived":false,"fork":false,"pushed_at":"2023-10-26T04:28:04.000Z","size":187,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-16T00:16:54.563Z","etag":null,"topics":["client","memcached","meta-command"],"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/QuangTung97.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}},"created_at":"2021-12-23T10:32:19.000Z","updated_at":"2024-03-06T02:29:59.000Z","dependencies_parsed_at":"2023-02-18T15:02:16.124Z","dependency_job_id":"847804da-b708-4e3a-8630-75e3fcec8c50","html_url":"https://github.com/QuangTung97/go-memcache","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuangTung97%2Fgo-memcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuangTung97%2Fgo-memcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuangTung97%2Fgo-memcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuangTung97%2Fgo-memcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuangTung97","download_url":"https://codeload.github.com/QuangTung97/go-memcache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224547298,"owners_count":17329427,"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","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":["client","memcached","meta-command"],"created_at":"2024-11-14T01:10:32.888Z","updated_at":"2024-11-14T01:10:33.317Z","avatar_url":"https://github.com/QuangTung97.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# High Performance Memcached Client\n\n[![go-memcache](https://github.com/QuangTung97/go-memcache/actions/workflows/go.yml/badge.svg)](https://github.com/QuangTung97/go-memcache/actions/workflows/go.yml)\n[![Coverage Status](https://coveralls.io/repos/github/QuangTung97/go-memcache/badge.svg?branch=master)](https://coveralls.io/github/QuangTung97/go-memcache?branch=master)\n\n### Why this Library?\n\nA Simple Memcached Client Library.\n\nSimilar to: https://github.com/bradfitz/gomemcache. \\\nBut faster (up to 2x in some benchmarks) and supporting pipelined DELETE \u0026 SET operations\n\nAnd mostly focused on the new meta commands:\nhttps://github.com/memcached/memcached/wiki/MetaCommands \\\nTo facilitate more complex caching algorithms (e.g. memcached lease).\n\nIt implemented using Batching \u0026 Pipelining to reduce syscalls,\nbatching can happen between clients of the same connection.\n\nPlease checkout this document for better understanding of request options and response values of this library:\nhttps://github.com/memcached/memcached/blob/master/doc/protocol.txt\n\n### Examples\n\nExamples can be found here: https://github.com/QuangTung97/go-memcache/tree/master/examples\n\n```go\npipeline := client.Pipeline()\ndefer pipeline.Finish()\n\nfn1 := pipeline.MGet(\"KEY01\", memcache.MGetOptions{})\nfn2 := pipeline.MGet(\"KEY02\", memcache.MGetOptions{})\n\ngetResp, err := fn1()\nfmt.Printf(\"GET: %+v %+v\\n\", getResp, err)\n\ngetResp, err = fn2()\nfmt.Printf(\"GET: %+v %+v\\n\", getResp, err)\n```\n\nIn this example, two meta get commands will be sent only in the call:\n\n```go\ngetResp, err := fn1()\n```\n\nIt will try to batch as much number of commands\nas possible to the underlining TCP Connections.\n\nBut if you do like this:\n\n```go\npipeline := client.Pipeline()\ndefer pipeline.Finish()\n\nfn1 := pipeline.MGet(\"KEY01\", memcache.MGetOptions{})\ngetResp, err := fn1()\nfmt.Printf(\"GET: %+v %+v\\n\", getResp, err)\n\nfn2 := pipeline.MGet(\"KEY02\", memcache.MGetOptions{})\ngetResp, err = fn2()\nfmt.Printf(\"GET: %+v %+v\\n\", getResp, err)\n```\n\nThen no batching is possible.\n\nThe line `defer pipeline.Finish()` is the best practise for preventing cases like this:\n\n```go\npipeline := client.Pipeline()\ndefer pipeline.Finish()\n\npipeline.MSet(\"KEY01\", []byte(\"key data 01\"), memcache.MSetOptions{})\npipeline.MSet(\"KEY02\", []byte(\"key data 02\"), memcache.MSetOptions{})\n```\n\nwithout `pipeline.Finish()` the two set commands will **NOT** be delivered to the memcached server. \\\nBecause the returned functions should be called, ``pipeline.Finsh()`` will do the calling if one forgotten.\n\n```\nfn := pipeline.MSet(\"KEY01\", []byte(\"key data 01\"), memcache.MSetOptions{})\n_, _ = fn()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquangtung97%2Fgo-memcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquangtung97%2Fgo-memcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquangtung97%2Fgo-memcache/lists"}