{"id":19411527,"url":"https://github.com/volcengine/dns-stale-cache","last_synced_at":"2026-02-07T07:03:42.507Z","repository":{"id":213451855,"uuid":"733854682","full_name":"volcengine/dns-stale-cache","owner":"volcengine","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-24T12:36:31.000Z","size":38,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-01T00:54:19.883Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/volcengine.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":"2023-12-20T09:30:34.000Z","updated_at":"2024-09-24T12:35:21.000Z","dependencies_parsed_at":"2023-12-21T05:21:16.870Z","dependency_job_id":"1a661c4a-e46d-4a1b-9347-3a87dee4d203","html_url":"https://github.com/volcengine/dns-stale-cache","commit_stats":null,"previous_names":["volcengine/dns-stale-cache"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/volcengine/dns-stale-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volcengine%2Fdns-stale-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volcengine%2Fdns-stale-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volcengine%2Fdns-stale-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volcengine%2Fdns-stale-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/volcengine","download_url":"https://codeload.github.com/volcengine/dns-stale-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volcengine%2Fdns-stale-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29188314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T05:07:31.176Z","status":"ssl_error","status_checked_at":"2026-02-07T05:06:15.227Z","response_time":63,"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":[],"created_at":"2024-11-10T12:21:51.610Z","updated_at":"2026-02-07T07:03:42.494Z","avatar_url":"https://github.com/volcengine.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Requirement\nFor Redis:\ngo-redis client version \u003e= v6.15\n\nFor RocketMQ:\nrocketmq-client-go version \u003e= v2\n\n### Installation\n```shell\ngo get github.com/volcengine/dns-stale-cache\n```\n\n### Example\n\n#### For rocketmq client/v2\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\t\"strconv\"\n\n\t\"github.com/apache/rocketmq-client-go/v2\"\n\t\"github.com/apache/rocketmq-client-go/v2/primitive\"\n\t\"github.com/apache/rocketmq-client-go/v2/producer\"\n\t. \"github.com/volcengine/dns-stale-cache/common\"\n\t. \"github.com/volcengine/dns-stale-cache/rocketmq/v2\"\n)\n\n// Package main implements a simple producer to send message.\nfunc main() {\n\taddrs := []string{\"localhost:9876\"}\n\t\n\tp, _ := rocketmq.NewProducer(\n\t\tproducer.WithNsResolver(NewCacheResolver(addrs,\n\t\t\tWithCacheFirst(true),\n\t\t\tWithIPConsistance(true),\n\t\t\tWithDnsTimeout(1*time.Second),\n\t\t)),\n\t\tproducer.WithRetry(2),\n\t)\n\terr := p.Start()\n\tif err != nil {\n\t\tfmt.Printf(\"start producer error: %s\", err.Error())\n\t\tos.Exit(1)\n\t}\n\ttopic := \"TopicTest\"\n\n\tfor i := 0; i \u003c 10; i++ {\n\t\tmsg := \u0026primitive.Message{\n\t\t\tTopic: topic,\n\t\t\tBody:  []byte(\"Hello RocketMQ Go Client! \" + strconv.Itoa(i)),\n\t\t}\n\t\tres, err := p.SendSync(context.Background(), msg)\n\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"send message error: %s\\n\", err)\n\t\t} else {\n\t\t\tfmt.Printf(\"send message success: result=%s\\n\", res.String())\n\t\t}\n\t}\n\terr = p.Shutdown()\n\tif err != nil {\n\t\tfmt.Printf(\"shutdown producer error: %s\", err.Error())\n\t}\n}\n\n\n```\n\n\n#### For redis client/v9\n```go\n\npackage main\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/redis/go-redis/v9\"\n\t. \"github.com/volcengine/dns-stale-cache/common\"\n\t. \"github.com/volcengine/dns-stale-cache/redis/v9\"\n)\n\nfunc ExampleNewClient() {\n\topt := \u0026redis.Options{\n\t\tAddr:     \"localhost:6379\", // use default Addr\n\t}\n\n\topt.Dialer = NewDialerWithCache(opt,\n\t\tWithCacheFirst(true),\n\t\tWithIPConsistance(true),\n\t\tWithDnsTimeout(2*time.Second),\n\t)\n\trdb := redis.NewClient(opt)\n\n\tpong, err := rdb.Ping(context.Background()).Result()\n\tfmt.Println(pong, err)\n\t// Output: PONG \u003cnil\u003e\n}\n\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolcengine%2Fdns-stale-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvolcengine%2Fdns-stale-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolcengine%2Fdns-stale-cache/lists"}