{"id":34202145,"url":"https://github.com/getmiranda/gomemcached","last_synced_at":"2026-05-27T01:32:21.876Z","repository":{"id":38048474,"uuid":"499998270","full_name":"getmiranda/gomemcached","owner":"getmiranda","description":"Provides a client for the Memcached server for Golang.","archived":false,"fork":false,"pushed_at":"2022-06-10T21:46:59.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-18T21:48:31.735Z","etag":null,"topics":["go","golang","memcache","memcached","memcached-client","sdk-go"],"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/getmiranda.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}},"created_at":"2022-06-05T04:19:15.000Z","updated_at":"2022-06-05T04:25:50.000Z","dependencies_parsed_at":"2022-08-24T10:40:46.356Z","dependency_job_id":null,"html_url":"https://github.com/getmiranda/gomemcached","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/getmiranda/gomemcached","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getmiranda%2Fgomemcached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getmiranda%2Fgomemcached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getmiranda%2Fgomemcached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getmiranda%2Fgomemcached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getmiranda","download_url":"https://codeload.github.com/getmiranda/gomemcached/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getmiranda%2Fgomemcached/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33546836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["go","golang","memcache","memcached","memcached-client","sdk-go"],"created_at":"2025-12-15T18:53:03.333Z","updated_at":"2026-05-27T01:32:21.864Z","avatar_url":"https://github.com/getmiranda.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Golang Memcached Client\n\nProvides a client for the memcached cache server. It is based on the [memcached](https://pkg.go.dev/github.com/bradfitz/gomemcache) package.\n\n## Prerequisites\n\nIn order to use this client you need to have a memcached server running. You can run the following command to start a memcached server with docker:\n\n```bash\ndocker run -d -p 11211:11211 --name memcached memcached\n```\n\n## Instalation\n\n```bash\ngo get github.com/getmiranda/gomemcached\n```\n\n## Usage\n\nIn order to use the library you need to import the corresponding package:\n\n```go\npackage main\n\nimport (\n    \"github.com/getmiranda/gomemcached/memcache\"\n)\n```\n\n### Configuring the client\n\nOnce you have imported the package, you can now start using the client. First you need to configure and build the client as you need:\n\n```go\n// Create a new builder:\nmemcacheClient := memcache.NewBuilder().\n    // Set the host(s):\n    WithServers(\"localhost:11211\").\n    // Set the timeout:\n    SetTimeout(time.Second * 5).\n    // Set the max number of connections per server:\n    SetMaxIdleConns(10).\n    // Finally, build the client and start using it!\n    Build()\n```\n\n### Using the client\n\nThe `Client` interface provides convenient methods that you can use to perform different operations. For example, you can get a value from the cache:\n\n```go\n// Get a value from the cache:\nvalue, err := memcacheClient.Get(\"key\")\n```\n\n## Testing\n\nThe library provides a convenient package for mocking items and getting a particular values. The mock key is the item key. Every item with the same kay will return the same item mock.\n\nIn order to use the mocking features you need to import the corresponding package:\n\n```go\npackage main\n\nimport (\n    \"github.com/getmiranda/gomemcached/memcachemock\"\n)\n```\n\n### Starting the mock server\n\n```go\nfunc TestMain(m *testing.M) {\n    // Tell the library to mock any further operations from here.\n    memcachemock.MockupServer.Start()\n\n    // Start the test cases for this pacakge:\n    os.Exit(m.Run())\n}\n```\n\nOnce you start the mock server, every operation will be handled by this server and will not be sent against the real memcached server. If there is no mock matching the current operation you'll get an error saying `mock not found`.\n\n### Configuring a given mock\n\n```go\nfunc TestMyTest(t *testing.T) {\n    // Delete all mocks in every new test case to ensure a clean environment:\n    memcachemock.MockupServer.DeleteMocks()\n\n    // Configure a new mock:\n    memcachemock.MockupServer.AddMock(\u0026memcachemock.Mock{\n        Operation: memcachemock.OperationGet,\n        Args:      memcachemock.Args{\"mykey\"},\n\n        Error: errors.New(\"mirandas\"),\n    })\n\n    it, err := memcacheClient.Get(\"mykey\")\n\n    ...\n}\n```\n\nIn this case, we're telling the memcache client that when we does a get operation with `mykey` argument, we want that particular error. In this case, no result was returned.\n\nLet's see how you can configure a particular value:\n\n```go\nfunc TestMyTest(t *testing.T) {\n    // Delete all mocks in every new test case to ensure a clean environment:\n    memcachemock.MockupServer.DeleteMocks()\n\n    // Configure a new mock:\n    memcachemock.MockupServer.AddMock(\u0026memcachemock.Mock{\n        Operation: memcachemock.OperationGet,\n        Args:      memcachemock.Args{\"mykey\"},\n\n        Return: \u0026item.Item{\n            Key:   \"mykey\",\n            Value: []byte(\"myvalue\"),\n        },\n    })\n\n    it, err := memcacheClient.Get(\"mykey\")\n\n    ...\n}\n```\n\nIn this case, we get an item from the cache.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetmiranda%2Fgomemcached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetmiranda%2Fgomemcached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetmiranda%2Fgomemcached/lists"}