text
stringlengths 0
2.2M
|
---|
DistoCacheClientUtils::~DistoCacheClientUtils() {
|
client->closeConnection();
|
delete client;
|
}
|
void DistoCacheClientUtils::allocate(const std::string& cacheKey, const std::string& type) {
|
AMEFEncoder encoder;
|
AMEFDecoder decoder;
|
AMEFObject* object = new AMEFObject;
|
object->addPacket("allocate "+type+" "+cacheKey);
|
lock.lock();
|
client->sendData(encoder.encodeB(object));
|
std::string resp = client->getBinaryData(4, false);
|
lock.unlock();
|
delete object;
|
object = decoder.decodeB(resp, true);
|
std::vector<std::string> ignoreErrors;readValueOrThrowExp(object, ignoreErrors);
|
}
|
void DistoCacheClientUtils::deallocate(const std::string& cacheKey) {
|
AMEFEncoder encoder;
|
AMEFDecoder decoder;
|
AMEFObject* object = new AMEFObject;
|
object->addPacket("deallocate "+cacheKey);
|
lock.lock();
|
client->sendData(encoder.encodeB(object));
|
std::string resp = client->getBinaryData(4, false);
|
lock.unlock();
|
delete object;
|
object = decoder.decodeB(resp, true);
|
std::vector<std::string> ignoreErrors;readValueOrThrowExp(object, ignoreErrors);
|
}
|
void DistoCacheClientUtils::addObjectEntry(const std::string& key, const std::string& value) {
|
AMEFEncoder encoder;
|
AMEFDecoder decoder;
|
AMEFObject* object = new AMEFObject;
|
object->addPacket("add objentry "+key);
|
object->addPacket(value);
|
lock.lock();
|
client->sendData(encoder.encodeB(object));
|
std::string resp = client->getBinaryData(4, false);
|
lock.unlock();
|
delete object;
|
object = decoder.decodeB(resp, true);
|
std::vector<std::string> ignoreErrors;readValueOrThrowExp(object, ignoreErrors);
|
}
|
void DistoCacheClientUtils::removeObjectEntry(const std::string& key) {
|
AMEFEncoder encoder;
|
AMEFDecoder decoder;
|
AMEFObject* object = new AMEFObject;
|
object->addPacket("remove objentry "+key);
|
lock.lock();
|
client->sendData(encoder.encodeB(object));
|
std::string resp = client->getBinaryData(4, false);
|
lock.unlock();
|
delete object;
|
object = decoder.decodeB(resp, true);
|
std::vector<std::string> ignoreErrors;readValueOrThrowExp(object, ignoreErrors);
|
}
|
std::string DistoCacheClientUtils::getObjectEntryValue(const std::string& key) {
|
AMEFEncoder encoder;
|
AMEFDecoder decoder;
|
AMEFObject* object = new AMEFObject;
|
object->addPacket("get objentry "+key);
|
lock.lock();
|
client->sendData(encoder.encodeB(object));
|
std::string resp = client->getBinaryData(4, false);
|
lock.unlock();
|
delete object;
|
object = decoder.decodeB(resp, true);
|
std::vector<std::string> ignoreErrors;resp = readValueOrThrowExp(object, ignoreErrors);
|
return resp;
|
}
|
void DistoCacheClientUtils::addMapEntry(const std::string& cacheKey, const std::string& key, const std::string& value) {
|
AMEFEncoder encoder;
|
AMEFDecoder decoder;
|
AMEFObject* object = new AMEFObject;
|
object->addPacket("add mapentry "+cacheKey + " " + key);
|
object->addPacket(value);
|
lock.lock();
|
client->sendData(encoder.encodeB(object));
|
std::string resp = client->getBinaryData(4, false);
|
lock.unlock();
|
delete object;
|
object = decoder.decodeB(resp, true);
|
std::vector<std::string> ignoreErrors;readValueOrThrowExp(object, ignoreErrors);
|
}
|
void DistoCacheClientUtils::removeMapEntry(const std::string& cacheKey, const std::string& key) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.