Commit 6582e378 authored by Guillaume Baulieu's avatar Guillaume Baulieu
Browse files

No need to convert Optional<> to optional<> now that we are using Cxx17

parent 0fef4c41
......@@ -89,11 +89,7 @@ void RedisCentralMemory::set(string key, string value){
optional<std::string> RedisCentralMemory::get(string key){
try{
auto r = this->getConnectionFromKey(key);
auto v = r->get(key);
if(v)
return optional<string>(*v);
else
return std::nullopt;
return r->get(key);
}
catch(sw::redis::MovedError& e){
if(redisErrorHandling(e.what(),key))
......@@ -147,11 +143,7 @@ void RedisCentralMemory::rpush(string key, string value){
optional< pair<string, string> > RedisCentralMemory::blpop(string key, float timeout){
try{
auto r = this->getConnectionFromKey(key);
auto v = r->blpop(key, timeout);
if(v)
return optional< pair<string, string> >(*v);
else
return std::nullopt;
return r->blpop(key, timeout);
}
catch(sw::redis::MovedError& e){
if(redisErrorHandling(e.what(),key))
......@@ -165,11 +157,7 @@ optional< pair<string, string> > RedisCentralMemory::blpop(string key, float tim
optional< string > RedisCentralMemory::lpop(string key){
try{
auto r = this->getConnectionFromKey(key);
auto v = r->lpop(key);
if(v)
return optional< string >(*v);
else
return std::nullopt;
return r->lpop(key);
}
catch(sw::redis::MovedError& e){
if(redisErrorHandling(e.what(),key))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment