/libvalkey

Valkey client library in C

Primary LanguageCOtherNOASSERTION

Libvalkey

Libvalkey is the official C client for the Valkey database. It also supports any server that uses the RESP protocol (version 2 or 3). This project supports both standalone and cluster modes.

Table of Contents

Features

  • Commands are executed in a generic way, with printf-like invocation.
  • Supports both RESP2 and RESP3 protocol versions.
  • Supports both synchronous and asynchronous operation.
  • Optional support for SSL and RDMA connections.
  • Asynchronous API with several event libraries to choose from.
  • Supports both standalone and cluster mode operation.
  • Can be compiled with either make or CMake.

Supported platforms

This library supports and is tested against Linux, FreeBSD, macOS, and Windows. It should build and run on various proprietary Unixes although we can't run CI for those platforms. If you encounter any issues, please open an issue.

Building

Libvalkey is written in C targeting C99. Unfortunately we have no plans on supporting C89 or earlier. The project does use a few widely supported compiler extensions, specifically for the bundled sds string library, although we have plans to remove this from the library.

We support plain GNU make and CMake. Following is information on how to build the library.

Building with make

# Build and install the default library
sudo make install

# With all options
sudo USE_SSL=1 USE_RDMA=1 make install

# If your openssl is in a non-default location
sudo USE_SSL=1 OPENSSL_PREFIX=/path/to/openssl make install

Building with CMake

See CMakeLists.txt for all available options.

# Build and install
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
sudo make install

# Build with TLS and RDMA support
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_SSL=1 -DENABLE_RDMA=1 ..
sudo make install

Contributing

Contributions from the community are welcome. Feel free to open a PR with a bugfix or new feature. Note that if you would like to merge a large feature it's probably a good idea to open an issue first rather than spending a lot of time on a PR that may not be accepted.