Пример Redis
This commit is contained in:
parent
ab825123f2
commit
8ff24d264c
@ -13,11 +13,10 @@ class RedisClient : public QObject
|
||||
MR::Request* m_request;
|
||||
|
||||
public:
|
||||
RedisClient()
|
||||
RedisClient(QObject* parent = nullptr) : QObject(parent)
|
||||
{
|
||||
connect(&m_client, &MR::Client::connected, this, &RedisClient::slotConnected);
|
||||
m_client.connectToHost("127.0.0.1");
|
||||
|
||||
}
|
||||
virtual ~RedisClient() {}
|
||||
|
||||
@ -33,6 +32,9 @@ public:
|
||||
qDebug() << const_cast<MR::Reply&>(reply).value().toString();
|
||||
m_request->disconnect();
|
||||
m_request->deleteLater();
|
||||
|
||||
m_request = m_client.sendCommand( "SET value 10" );
|
||||
connect(m_request, &MR::Request::reply, this, &RedisClient::slotSetValue);
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +64,6 @@ public:
|
||||
Q_SLOT void slotSubscribeTest( const MR::Reply& reply)
|
||||
{
|
||||
qDebug() << static_cast<int>(reply.type());
|
||||
qDebug() << const_cast<MR::Reply&>(reply).value().toByteArray();
|
||||
qDebug() << const_cast<MR::Reply&>(reply).value();
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user