mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 02:53:10 +01:00
Redis: added Command::ping() and Client::isConnected()
This commit is contained in:
@@ -22,39 +22,39 @@ namespace Poco {
|
||||
namespace Redis {
|
||||
|
||||
|
||||
Client::Client():
|
||||
_address(),
|
||||
_socket(),
|
||||
_input(0),
|
||||
Client::Client():
|
||||
_address(),
|
||||
_socket(),
|
||||
_input(0),
|
||||
_output(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Client::Client(const std::string& hostAndPort):
|
||||
_address(hostAndPort),
|
||||
_socket(),
|
||||
_input(0),
|
||||
_address(hostAndPort),
|
||||
_socket(),
|
||||
_input(0),
|
||||
_output(0)
|
||||
{
|
||||
connect();
|
||||
}
|
||||
|
||||
|
||||
Client::Client(const std::string& host, int port):
|
||||
_address(host, port),
|
||||
_socket(),
|
||||
_input(0),
|
||||
Client::Client(const std::string& host, int port):
|
||||
_address(host, port),
|
||||
_socket(),
|
||||
_input(0),
|
||||
_output(0)
|
||||
{
|
||||
connect();
|
||||
}
|
||||
|
||||
|
||||
Client::Client(const Net::SocketAddress& addrs):
|
||||
_address(addrs),
|
||||
_socket(),
|
||||
_input(0),
|
||||
Client::Client(const Net::SocketAddress& addrs):
|
||||
_address(addrs),
|
||||
_socket(),
|
||||
_input(0),
|
||||
_output(0)
|
||||
{
|
||||
connect();
|
||||
@@ -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