From 89da7b33fe578fc545deebfb26dafbc80362a164 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Thu, 6 Apr 2017 21:48:15 +0100 Subject: [PATCH] Add INCR command --- include/incredis/incredis.hpp | 1 + src/incredis.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/incredis/incredis.hpp b/include/incredis/incredis.hpp index 4318071..4f1a7a9 100644 --- a/include/incredis/incredis.hpp +++ b/include/incredis/incredis.hpp @@ -89,6 +89,7 @@ namespace redis { //String opt_string get ( boost::string_ref parKey ); bool set ( boost::string_ref parKey, boost::string_ref parField ); + RedisInt incr ( boost::string_ref parKey ); private: static opt_string_list reply_to_string_list ( const Reply& parReply ); diff --git a/src/incredis.cpp b/src/incredis.cpp index 60b1bed..f69eb9a 100644 --- a/src/incredis.cpp +++ b/src/incredis.cpp @@ -156,4 +156,9 @@ namespace redis { const auto ret = redis::get(batch.replies().front()); return ret.is_ok(); } + + RedisInt IncRedis::incr (boost::string_ref parKey) { + const auto ret = redis::get(m_command.run("INCR", parKey)); + return ret; + } } //namespace redis