mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-18 11:39:00 +02:00
Redis: added Command::ping() and Client::isConnected()
This commit is contained in:
@@ -116,6 +116,9 @@ public:
|
||||
void disconnect();
|
||||
/// Disconnects from the Redis server.
|
||||
|
||||
bool isConnected() const;
|
||||
/// Returns true iff the Client is connected to a Redis server.
|
||||
|
||||
template<typename T>
|
||||
T execute(const Array& command)
|
||||
/// Sends the Redis Command to the server. It gets the reply
|
||||
|
@@ -252,6 +252,9 @@ public:
|
||||
|
||||
static Command rpush(const std::string& list, const StringVec& value, bool create = true);
|
||||
/// Creates and returns a RPUSH or RPUSHX (when create is false) command.
|
||||
|
||||
static Command ping();
|
||||
/// Creates and returns a PING command.
|
||||
};
|
||||
|
||||
|
||||
|
@@ -144,6 +144,12 @@ void Client::disconnect()
|
||||
}
|
||||
|
||||
|
||||
bool Client::isConnected() const
|
||||
{
|
||||
return _input != 0;
|
||||
}
|
||||
|
||||
|
||||
void Client::writeCommand(const Array& command, bool doFlush)
|
||||
{
|
||||
poco_assert(_output);
|
||||
|
@@ -683,4 +683,12 @@ Command Command::rpush(const std::string& list, const StringVec& values, bool cr
|
||||
}
|
||||
|
||||
|
||||
Command Command::ping()
|
||||
{
|
||||
Command cmd("PING");
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Redis
|
||||
|
Reference in New Issue
Block a user