Cloned from https://github.com/nathan-osman/qredis and modified it according to Qt6.
Go to file
Nathan Osman 1b45cb3777 Added generic reply() signal to Request class. 2013-07-04 14:14:53 -07:00
include/qredis Added generic reply() signal to Request class. 2013-07-04 14:14:53 -07:00
src Added generic reply() signal to Request class. 2013-07-04 14:14:53 -07:00
tests Implemented parsing of bulk replies and added test for data storage. 2013-07-04 09:43:29 -07:00
.gitignore Initial commit 2013-06-28 15:58:50 -07:00
CMakeLists.txt Implemented sending of requests in tests and removed dependencies on C++11 features to allow older compilers to compile the client library and test suite. 2013-07-02 15:26:19 -07:00
LICENSE Added the full text of the MIT license to the project. 2013-06-29 11:40:09 -07:00
README.md Removed outdated statement in README about C++11 constructs. 2013-07-02 22:59:08 -07:00

README.md

QRedis

QRedis provides a modern Qt client library for communicating with a Redis server. The code compiles exclusively with Qt 5, ensuring years of compatibility down the road.

Requirements

To compile QRedis, the following requirements must be met:

  • GCC or Microsoft Visual C++
  • Qt 5+

It is not necessary to have Redis installed in order to build the client library. However, you will be unable to run the test suite.

Building QRedis

QRedis uses CMake for building the client library, which simplifies the necessary steps across all supported platforms. Assuming you have Qt 5 installed in a location that CMake can find, the client library can be built with the following steps:

  1. Open a terminal and navigate to the directory containing the QRedis source code.

  2. Create a new directory that will contain the object and binary files produced by the build system and change to that directory:

     mkdir build
     cd build
    
  3. Run CMake, which will produce the appropriate Makefile for your platform:

     cmake ..
    
  4. On Unix-based build systems (including MSYS and Cygwin), run:

     make
    

    For Microsoft Visual C++, run:

     nmake
    

Usage

In order to send commands to a Redis server, you need to create an instance of the Client class and connect to the server. For example, if Redis is running on the same server as your application, your code might look something like this:

#include <qredis/client.h>

QRedis::Client client;
client.connectToHost("localhost");

Once the connection is complete, the client will emit the connected() signal. You can then begin executing commands. For example, to send the PING command:

QRedis::Command * command = client.sendCommand("PING");

The sendCommand() method returns a Command *, which provides signals to indicate when the command has completed or when an error occurs.