added Redis library

This commit is contained in:
Günter Obiltschnig
2017-11-08 15:48:04 +01:00
parent 47043e0f4f
commit 6a0191ae6c
93 changed files with 16311 additions and 40 deletions

63
Redis/src/AsyncReader.cpp Normal file
View File

@@ -0,0 +1,63 @@
//
// AsyncReader.cpp
//
// $Id$
//
// Library: Redis
// Package: Redis
// Module: AsyncReader
//
// Implementation of the AsyncReader class.
//
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/Redis/AsyncReader.h"
namespace Poco {
namespace Redis {
AsyncReader::AsyncReader(Client& client):
_client(client),
_activity(this, &AsyncReader::runActivity)
{
}
AsyncReader::~AsyncReader()
{
stop();
}
void AsyncReader::runActivity()
{
while (!_activity.isStopped())
{
try
{
RedisType::Ptr reply = _client.readReply();
RedisEventArgs args(reply);
redisResponse.notify(this, args);
if ( args.isStopped() ) stop();
}
catch (Exception& e)
{
RedisEventArgs args(&e);
redisException.notify(this, args);
stop();
}
if (!_activity.isStopped()) Thread::trySleep(100);
}
}
} } // namespace Poco::Redis