compat.redis-plus-plus
C++ client for Redis (sync API; built from source, depends on compat.hiredis)
mcpp add compat.redis-plus-plus@1.3.13
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
// redis_test.cpp — offline behavioral test for the `async` feature of
// compat.redis-plus-plus (libuv-backed AsyncRedis).
//
// No redis-server binary and no network access: a minimal RESP server runs
// inside the process (raw loopback sockets, same platform abstraction as the
// websocket member) and the sw::redis::AsyncRedis client is driven against it.
// The async client can pipeline PING + SET into a single TCP segment, so the
// server parses complete RESP arrays instead of scanning for keywords.
#include <sw/redis++/async_redis++.h>
#include <atomic>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <string>
#include <thread>
// ── Platform socket abstraction (same as tests/examples/websocket) ─────────
#ifdef _WIN32
#include <winsock2.h>
// …
tests/examples/redis-plus-plus-async/tests/redis_test.cpp · 项目 tests/examples/redis-plus-plus-async
构建
- targets
redis_plus_plus (lib)- language
c++23- import std
- no
- include dirs
*/src, */src/sw/redis++/cxx17, */src/sw/redis++/no_tls, */src/sw/redis++/future/std, mcpp_generated
特性
| 特性 | 声明了 |
|---|---|
| async | sources, deps |
源文件 (17)
*/src/sw/redis++/command.cpp*/src/sw/redis++/command_options.cpp*/src/sw/redis++/connection.cpp*/src/sw/redis++/connection_pool.cpp*/src/sw/redis++/crc16.cpp*/src/sw/redis++/errors.cpp*/src/sw/redis++/pipeline.cpp*/src/sw/redis++/redis.cpp*/src/sw/redis++/redis_cluster.cpp*/src/sw/redis++/redis_uri.cpp*/src/sw/redis++/reply.cpp*/src/sw/redis++/sentinel.cpp*/src/sw/redis++/shards.cpp*/src/sw/redis++/shards_pool.cpp*/src/sw/redis++/subscriber.cpp*/src/sw/redis++/transaction.cpp*/src/sw/redis++/patterns/redlock.cpp
生成的文件
mcpp_generated/sw/redis++/hiredis_features.h