{"id":19124224,"url":"https://github.com/tair-opensource/tair-client","last_synced_at":"2025-05-05T19:12:09.413Z","repository":{"id":203225844,"uuid":"686834195","full_name":"tair-opensource/tair-client","owner":"tair-opensource","description":"A C++ client for connecting to Tair, fully Redis compatible.","archived":false,"fork":false,"pushed_at":"2023-11-30T11:19:30.000Z","size":19198,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-02-22T12:28:31.928Z","etag":null,"topics":["nosql","redis-client","tair"],"latest_commit_sha":null,"homepage":"","language":"C++","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/tair-opensource.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":"2023-09-04T03:27:52.000Z","updated_at":"2023-12-27T09:47:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"153ef15f-5546-4c9f-89d7-67f633ce5adc","html_url":"https://github.com/tair-opensource/tair-client","commit_stats":null,"previous_names":["tair-opensource/tair-client"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tair-opensource%2Ftair-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tair-opensource%2Ftair-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tair-opensource%2Ftair-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tair-opensource%2Ftair-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tair-opensource","download_url":"https://codeload.github.com/tair-opensource/tair-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223789626,"owners_count":17203231,"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":["nosql","redis-client","tair"],"created_at":"2024-11-09T05:28:26.795Z","updated_at":"2024-11-09T05:28:28.794Z","avatar_url":"https://github.com/tair-opensource.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tair C++ Client\n\nTair C++ Client is a client used to connect to Tair, it can also be used to connect to Redis, because Tair is fully compatible with Redis.\n\n- Asynchronous and provides a synchronous future interface\n- Support Standalone and Cluster\n- Support seamless switching capabilities [WIP]\n- Support rust, go, python interfaces [WIP]\n\n# How to Use\n\n1. build deps\n```\n./bootstrap.sh deps release[debug]\n```\n\n2. build source\n```\n./bootstrap.sh build release[debug]\n```\n\n3. [optional] start redis at `tests/ut_tests/client/TairClient_Standalone_Server.cpp#STANDALONE_ADDR`(default: 127.0.0.1:6379) and run test\n```\n./bootstrap.sh test\n```\n\n# Example\n```\n#include \"client/TairClient.hpp\"\n#include \"client/TairResult.hpp\"\n#include \"common/CountDownLatch.hpp\"\n\n#include \u003ciostream\u003e\n\nusing tair::client::TairClient;\nusing tair::client::TairURI;\nusing tair::client::TairResult;\nusing tair::common::CountDownLatch;\n\nint main(int argc, char *argv[]) {\n    // connect\n    auto *client = new TairClient();\n    TairURI uri = TairURI::create()\n            .type(TairURI::STANDALONE)\n            .serverAddrs({\"127.0.0.1:6379\"})\n            .connectingTimeoutMs(3000)\n            .build();\n    if (!client-\u003einit(uri).isSuccess()) {\n        std::cerr \u003c\u003c \"Connect error, see logs for detail\" \u003c\u003c std::endl;\n    }\n\n    // sync usage\n    auto wrapper = client-\u003egetFutureWrapper();\n    std::future\u003cTairResult\u003cstd::string\u003e\u003e f = wrapper.set(\"key\", \"value\");\n    if (f.get().isSuccess()) {\n        std::cout \u003c\u003c \"set key success\" \u003c\u003c std::endl;\n    } else {\n        std::cerr \u003c\u003c \"set key fail\" \u003c\u003c std::endl;\n    }\n\n    // async usage, we need a latch to pending\n    CountDownLatch latch;\n    client-\u003eget(\"key\", [\u0026](const TairResult\u003cstd::shared_ptr\u003cstd::string\u003e\u003e \u0026result) {\n        latch.countDown();\n        if (result.isSuccess()) {\n            std::cout \u003c\u003c \"get key: \" \u003c\u003c *(result.getValue()) \u003c\u003c std::endl;\n        } else {\n            std::cerr \u003c\u003c \"get key fail\" \u003c\u003c std::endl;\n        }\n    });\n    latch.wait();\n    \n    // destroy\n    client-\u003edestroy();\n}\n```\nFor more examples please refer to the examples directory.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftair-opensource%2Ftair-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftair-opensource%2Ftair-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftair-opensource%2Ftair-client/lists"}