RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
00001 /* redis_utils.cc 00002 Wolfgang Sourdeau, 17 December 2012 00003 Copyright (c) 2012 Datacratic. All rights reserved. 00004 00005 Redis migration class 00006 */ 00007 #include "soa/service/redis.h" 00008 00009 #include "redis_utils.h" 00010 00011 00012 namespace RTBKIT { 00013 00014 using namespace Redis; 00015 00016 bool 00017 GetRedisReplyAsInt(const Reply & reply, long long int & value) 00018 { 00019 bool result(true); 00020 00021 switch (reply.type()) { 00022 case STRING: 00023 value = atoll(reply.asString().c_str()); 00024 break; 00025 case INTEGER: 00026 value = reply.asInt(); 00027 break; 00028 case NIL: 00029 value = 0; 00030 break; 00031 default: 00032 result = false; 00033 } 00034 00035 return result; 00036 } 00037 00038 } // namespace RTBKIT