diff --git a/include/incredis/arg_to_bin_safe.hpp b/include/incredis/arg_to_bin_safe.hpp index 8f42def..5981e1d 100644 --- a/include/incredis/arg_to_bin_safe.hpp +++ b/include/incredis/arg_to_bin_safe.hpp @@ -20,7 +20,7 @@ #include "duckhandy/compatibility.h" #include -#include +#include #include namespace redis { @@ -45,8 +45,8 @@ namespace redis { }; template<> - struct MakeCharInfo { - MakeCharInfo ( const boost::string_ref& parData ) : m_data(parData.data()), m_size(parData.size()) {} + struct MakeCharInfo { + MakeCharInfo ( const boost::string_view& parData ) : m_data(parData.data()), m_size(parData.size()) {} const char* data ( void ) const { return m_data; } std::size_t size ( void ) const { return m_size; } @@ -73,7 +73,7 @@ namespace redis { std::size_t size ( void ) const { return m_data.size(); } private: - boost::string_ref m_data; + boost::string_view m_data; }; template diff --git a/include/incredis/batch.hpp b/include/incredis/batch.hpp index 77d7b14..5950f8d 100644 --- a/include/incredis/batch.hpp +++ b/include/incredis/batch.hpp @@ -75,12 +75,12 @@ namespace redis { using implem::arg_to_bin_safe_char; using implem::arg_to_bin_safe_length; using implem::MakeCharInfo; - using boost::string_ref; + using boost::string_view; this->run_pvt( static_cast(arg_count), - CharPointerArray{ (arg_to_bin_safe_char(string_ref(parCommand))), MakeCharInfo::type>::type>(std::forward(parArgs)).data()... }.data(), - LengthArray{ arg_to_bin_safe_length(string_ref(parCommand)), arg_to_bin_safe_length(std::forward(parArgs))... }.data() + CharPointerArray{ (arg_to_bin_safe_char(string_view(parCommand))), MakeCharInfo::type>::type>(std::forward(parArgs)).data()... }.data(), + LengthArray{ arg_to_bin_safe_length(string_view(parCommand)), arg_to_bin_safe_length(std::forward(parArgs))... }.data() ); return *this; diff --git a/include/incredis/command.hpp b/include/incredis/command.hpp index f41a8d3..0b7a7e3 100644 --- a/include/incredis/command.hpp +++ b/include/incredis/command.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ namespace redis { void wait_for_disconnect ( void ); bool is_connected ( void ) const; - boost::string_ref connection_error ( void ) const; + boost::string_view connection_error ( void ) const; Batch make_batch ( void ); Script make_script ( const std::string& parScript ); diff --git a/include/incredis/incredis.hpp b/include/incredis/incredis.hpp index 31000a4..ab9b8f3 100644 --- a/include/incredis/incredis.hpp +++ b/include/incredis/incredis.hpp @@ -23,7 +23,7 @@ #include "scan_iterator.hpp" #include #include -#include +#include #include #include #include @@ -61,26 +61,26 @@ namespace redis { const Command& command ( void ) const { return m_command; } //Scan - scan_range scan ( boost::string_ref parPattern=boost::string_ref() ); - hscan_range hscan ( boost::string_ref parKey, boost::string_ref parPattern=boost::string_ref() ); - sscan_range sscan ( boost::string_ref parKey, boost::string_ref parPattern=boost::string_ref() ); - zscan_range zscan ( boost::string_ref parKey, boost::string_ref parPattern=boost::string_ref() ); + scan_range scan ( boost::string_view parPattern=boost::string_view() ); + hscan_range hscan ( boost::string_view parKey, boost::string_view parPattern=boost::string_view() ); + sscan_range sscan ( boost::string_view parKey, boost::string_view parPattern=boost::string_view() ); + zscan_range zscan ( boost::string_view parKey, boost::string_view parPattern=boost::string_view() ); //Hash - opt_string hget ( boost::string_ref parKey, boost::string_ref parField ); + opt_string hget ( boost::string_view parKey, boost::string_view parField ); template - opt_string_list hmget ( boost::string_ref parKey, Args&&... parArgs ); + opt_string_list hmget ( boost::string_view parKey, Args&&... parArgs ); template - bool hmset ( boost::string_ref parKey, Args&&... parArgs ); - int hincrby ( boost::string_ref parKey, boost::string_ref parField, int parInc ); + bool hmset ( boost::string_view parKey, Args&&... parArgs ); + int hincrby ( boost::string_view parKey, boost::string_view parField, int parInc ); //Set - opt_string_list srandmember ( boost::string_ref parKey, int parCount ); - opt_string srandmember ( boost::string_ref parKey ); - opt_string_list smembers ( boost::string_ref parKey ); + opt_string_list srandmember ( boost::string_view parKey, int parCount ); + opt_string srandmember ( boost::string_view parKey ); + opt_string_list smembers ( boost::string_view parKey ); //Sorted set - opt_string_list zrangebyscore ( boost::string_ref parKey, double parMin, bool parMinIncl, double parMax, bool parMaxIncl, bool parWithScores ); + opt_string_list zrangebyscore ( boost::string_view parKey, double parMin, bool parMinIncl, double parMax, bool parMaxIncl, bool parWithScores ); //Script bool script_flush ( void ); @@ -88,12 +88,12 @@ namespace redis { //Misc bool flushdb ( void ); RedisInt dbsize ( void ); - bool expire ( boost::string_ref parKey, RedisInt parTTL ); + bool expire ( boost::string_view parKey, RedisInt parTTL ); //String - opt_string get ( boost::string_ref parKey ); - bool set ( boost::string_ref parKey, boost::string_ref parField ); - RedisInt incr ( boost::string_ref parKey ); + opt_string get ( boost::string_view parKey ); + bool set ( boost::string_view parKey, boost::string_view parField ); + RedisInt incr ( boost::string_view parKey ); private: static opt_string_list reply_to_string_list ( const Reply& parReply ); @@ -102,13 +102,13 @@ namespace redis { }; template - auto IncRedis::hmget (boost::string_ref parKey, Args&&... parArgs) -> opt_string_list { + auto IncRedis::hmget (boost::string_view parKey, Args&&... parArgs) -> opt_string_list { static_assert(sizeof...(Args) > 0, "No fields specified"); return reply_to_string_list(m_command.run("HMGET", parKey, std::forward(parArgs)...)); } template - bool IncRedis::hmset (boost::string_ref parKey, Args&&... parArgs) { + bool IncRedis::hmset (boost::string_view parKey, Args&&... parArgs) { static_assert(sizeof...(Args) > 0, "No fields specified"); static_assert(sizeof...(Args) % 2 == 0, "Uneven number of parameters received"); const auto ret = redis::get(m_command.run("HMSET", parKey, std::forward(parArgs)...)); diff --git a/include/incredis/incredis_batch.hpp b/include/incredis/incredis_batch.hpp index def7efe..59b2c83 100644 --- a/include/incredis/incredis_batch.hpp +++ b/include/incredis/incredis_batch.hpp @@ -20,7 +20,7 @@ #include "batch.hpp" #include "duckhandy/sequence_bt.hpp" -#include +#include #include #include @@ -54,33 +54,33 @@ namespace redis { //Misc IncRedisBatch& select ( int parIndex ); - IncRedisBatch& client_setname ( boost::string_ref parName ); + IncRedisBatch& client_setname ( boost::string_view parName ); template IncRedisBatch& del ( Args&&... parArgs ); //String - IncRedisBatch& set ( boost::string_ref parKey, boost::string_ref parField, ADD_Mode parMode ); + IncRedisBatch& set ( boost::string_view parKey, boost::string_view parField, ADD_Mode parMode ); template - IncRedisBatch& set ( boost::string_ref parKey, boost::string_ref parField, ADD_Mode parMode, Args&&... parArgs ); + IncRedisBatch& set ( boost::string_view parKey, boost::string_view parField, ADD_Mode parMode, Args&&... parArgs ); //Hash - IncRedisBatch& hget ( boost::string_ref parKey, boost::string_ref parField ); + IncRedisBatch& hget ( boost::string_view parKey, boost::string_view parField ); template - IncRedisBatch& hmget ( boost::string_ref parKey, Args&&... parArgs ); + IncRedisBatch& hmget ( boost::string_view parKey, Args&&... parArgs ); template - IncRedisBatch& hmset ( boost::string_ref parKey, Args&&... parArgs ); - IncRedisBatch& hincrby ( boost::string_ref parKey, boost::string_ref parField, int parInc ); + IncRedisBatch& hmset ( boost::string_view parKey, Args&&... parArgs ); + IncRedisBatch& hincrby ( boost::string_view parKey, boost::string_view parField, int parInc ); //Set - IncRedisBatch& srandmember ( boost::string_ref parKey, int parCount ); - IncRedisBatch& srandmember ( boost::string_ref parKey ); + IncRedisBatch& srandmember ( boost::string_view parKey, int parCount ); + IncRedisBatch& srandmember ( boost::string_view parKey ); template - IncRedisBatch& sadd ( boost::string_ref parKey, Args&&... parArgs ); + IncRedisBatch& sadd ( boost::string_view parKey, Args&&... parArgs ); //Sorted set template - IncRedisBatch& zadd ( boost::string_ref parKey, ZADD_Mode parMode, bool parChange, Args&&... parArgs ); - IncRedisBatch& zrangebyscore ( boost::string_ref parKey, double parMin, bool parMinIncl, double parMax, bool parMaxIncl, bool parWithScores ); + IncRedisBatch& zadd ( boost::string_view parKey, ZADD_Mode parMode, bool parChange, Args&&... parArgs ); + IncRedisBatch& zrangebyscore ( boost::string_view parKey, double parMin, bool parMinIncl, double parMax, bool parMaxIncl, bool parWithScores ); //Script IncRedisBatch& script_flush ( void ); @@ -95,14 +95,14 @@ namespace redis { } //namespace implem template - IncRedisBatch& IncRedisBatch::hmget (boost::string_ref parKey, Args&&... parArgs) { + IncRedisBatch& IncRedisBatch::hmget (boost::string_view parKey, Args&&... parArgs) { static_assert(sizeof...(Args) > 0, "No fields specified"); m_batch.run("HMGET", parKey, std::forward(parArgs)...); return *this; } template - IncRedisBatch& IncRedisBatch::hmset (boost::string_ref parKey, Args&&... parArgs) { + IncRedisBatch& IncRedisBatch::hmset (boost::string_view parKey, Args&&... parArgs) { static_assert(sizeof...(Args) >= 1, "No parameters specified"); static_assert(sizeof...(Args) % 2 == 0, "Uneven number of parameters received"); m_batch.run("HMSET", parKey, std::forward(parArgs)...); @@ -110,7 +110,7 @@ namespace redis { } template - IncRedisBatch& IncRedisBatch::sadd (boost::string_ref parKey, Args&&... parArgs) { + IncRedisBatch& IncRedisBatch::sadd (boost::string_view parKey, Args&&... parArgs) { static_assert(sizeof...(Args) > 0, "No members specified"); m_batch.run("SADD", parKey, std::forward(parArgs)...); return *this; @@ -124,7 +124,7 @@ namespace redis { } template - IncRedisBatch& IncRedisBatch::zadd (boost::string_ref parKey, ZADD_Mode parMode, bool parChange, Args&&... parArgs) { + IncRedisBatch& IncRedisBatch::zadd (boost::string_view parKey, ZADD_Mode parMode, bool parChange, Args&&... parArgs) { static_assert(sizeof...(Args) >= 1, "No score/value pairs specified"); static_assert(sizeof...(Args) % 2 == 0, "Uneven number of parameters received"); @@ -150,7 +150,7 @@ namespace redis { } template - IncRedisBatch& IncRedisBatch::set (boost::string_ref parKey, boost::string_ref parField, ADD_Mode parMode, Args&&... parArgs) { + IncRedisBatch& IncRedisBatch::set (boost::string_view parKey, boost::string_view parField, ADD_Mode parMode, Args&&... parArgs) { using dhandy::bt::index_range; switch(parMode) { diff --git a/include/incredis/scan_iterator.hpp b/include/incredis/scan_iterator.hpp index ddd5fcd..21cd426 100644 --- a/include/incredis/scan_iterator.hpp +++ b/include/incredis/scan_iterator.hpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include namespace redis { template @@ -40,18 +40,18 @@ namespace redis { class ScanIteratorBaseClass { protected: explicit ScanIteratorBaseClass ( Command* parCommand ); - ScanIteratorBaseClass ( Command* parCommand, boost::string_ref parMatchPattern ); + ScanIteratorBaseClass ( Command* parCommand, boost::string_view parMatchPattern ); ~ScanIteratorBaseClass ( void ) noexcept = default; bool is_connected ( void ) const; Reply run ( const char* parCommand, RedisInt parScanContext, std::size_t parCount ); - Reply run ( const char* parCommand, const boost::string_ref& parParameter, RedisInt parScanContext, std::size_t parCount ); + Reply run ( const char* parCommand, const boost::string_view& parParameter, RedisInt parScanContext, std::size_t parCount ); bool is_equal ( const ScanIteratorBaseClass& parOther ) const { return m_command == parOther.m_command; } private: Command* m_command; - boost::string_ref m_match_pattern; + boost::string_view m_match_pattern; }; } //namespace implem @@ -72,9 +72,9 @@ namespace redis { typedef typename base_iterator::iterator_category iterator_category; template ::value>::type> - ScanIterator ( Command* parCommand, bool parEnd, boost::string_ref parMatchPattern=boost::string_ref() ); + ScanIterator ( Command* parCommand, bool parEnd, boost::string_view parMatchPattern=boost::string_view() ); template ::value>::type> - ScanIterator ( Command* parCommand, boost::string_ref parKey, bool parEnd, boost::string_ref parMatchPattern=boost::string_ref() ); + ScanIterator ( Command* parCommand, boost::string_view parKey, bool parEnd, boost::string_view parMatchPattern=boost::string_view() ); private: template @@ -107,17 +107,17 @@ namespace redis { struct ScanSingleValuesInKey { typedef T value_type; - explicit ScanSingleValuesInKey ( boost::string_ref parScanTarget ) : m_scan_target(parScanTarget) {} + explicit ScanSingleValuesInKey ( boost::string_view parScanTarget ) : m_scan_target(parScanTarget) {} static constexpr const char* command ( void ) { return "SSCAN"; } static constexpr const std::size_t step = 1; static constexpr const std::size_t work_count = 10; static const T& make_value ( const Reply* parItem ); - boost::string_ref scan_target ( void ) const { return m_scan_target; } + boost::string_view scan_target ( void ) const { return m_scan_target; } private: - boost::string_ref m_scan_target; + boost::string_view m_scan_target; }; template @@ -125,17 +125,17 @@ namespace redis { static_assert(Command == ScanCommands::HSCAN or Command == ScanCommands::ZSCAN, "Invalid scan command chosen"); typedef P value_type; - explicit ScanPairs ( boost::string_ref parScanTarget ) : m_scan_target(parScanTarget) {} + explicit ScanPairs ( boost::string_view parScanTarget ) : m_scan_target(parScanTarget) {} static constexpr const char* command ( void ) { return ScanCommands::_from_integral(Command)._to_string(); } static constexpr const std::size_t step = 2; static constexpr const std::size_t work_count = 10; static value_type make_value ( const Reply* parItem ); - boost::string_ref scan_target ( void ) const { return m_scan_target; } + boost::string_view scan_target ( void ) const { return m_scan_target; } private: - boost::string_ref m_scan_target; + boost::string_view m_scan_target; }; } //namespace redis diff --git a/include/incredis/scan_iterator.inl b/include/incredis/scan_iterator.inl index d748e17..6a33ad4 100644 --- a/include/incredis/scan_iterator.inl +++ b/include/incredis/scan_iterator.inl @@ -25,7 +25,7 @@ namespace redis { template template - ScanIterator::ScanIterator (Command* parCommand, bool parEnd, boost::string_ref parMatchPattern) : + ScanIterator::ScanIterator (Command* parCommand, bool parEnd, boost::string_view parMatchPattern) : implem::ScanIteratorBaseClass(parCommand, parMatchPattern), implem::ScanIteratorBaseIterator(), ValueFetch(), @@ -45,7 +45,7 @@ namespace redis { template template - ScanIterator::ScanIterator (Command* parCommand, boost::string_ref parKey, bool parEnd, boost::string_ref parMatchPattern) : + ScanIterator::ScanIterator (Command* parCommand, boost::string_view parKey, bool parEnd, boost::string_view parMatchPattern) : implem::ScanIteratorBaseClass(parCommand, parMatchPattern), implem::ScanIteratorBaseIterator(), ValueFetch(parKey), diff --git a/include/incredis/script.hpp b/include/incredis/script.hpp index 97df99a..0758d21 100644 --- a/include/incredis/script.hpp +++ b/include/incredis/script.hpp @@ -21,7 +21,7 @@ #include "batch.hpp" #include "duckhandy/lexical_cast.hpp" #include "duckhandy/sequence_bt.hpp" -#include +#include #include #include #include @@ -33,7 +33,7 @@ namespace redis { public: Script ( void ); Script ( Script&& ) = default; - Script ( boost::string_ref parSha1, ScriptManager& parManager ); + Script ( boost::string_view parSha1, ScriptManager& parManager ); ~Script ( void ) noexcept = default; template @@ -45,7 +45,7 @@ namespace redis { template void run_with_indices ( Batch& parBatch, const std::tuple& parKeys, const std::tuple& parValues, dhandy::bt::index_seq, dhandy::bt::index_seq ); - boost::string_ref m_sha1; + boost::string_view m_sha1; ScriptManager* m_manager; }; diff --git a/include/incredis/script_manager.hpp b/include/incredis/script_manager.hpp index 9dfe9c6..4c9270c 100644 --- a/include/incredis/script_manager.hpp +++ b/include/incredis/script_manager.hpp @@ -22,7 +22,7 @@ #if defined(WITH_CRYPTOPP) # define MAKE_SHA1_WITH_CRYPTOPP #endif -#include +#include #if defined(MAKE_SHA1_WITH_CRYPTOPP) # include #else @@ -30,7 +30,6 @@ #endif #include #include -#include namespace redis { class Command; @@ -39,12 +38,12 @@ namespace redis { public: explicit ScriptManager ( Command* parCommand ); - boost::string_ref submit_lua_script ( const std::string& parScript ); + boost::string_view submit_lua_script ( const std::string& parScript ); private: using Sha1Array = std::array; - boost::string_ref add_lua_script_ifn ( const std::string& parScript ); + boost::string_view add_lua_script_ifn ( const std::string& parScript ); Command* const m_command; #if defined(MAKE_SHA1_WITH_CRYPTOPP) @@ -54,7 +53,7 @@ namespace redis { #endif }; - inline boost::string_ref ScriptManager::submit_lua_script (const std::string& parScript) { + inline boost::string_view ScriptManager::submit_lua_script (const std::string& parScript) { return add_lua_script_ifn(parScript); } } //namespace redis diff --git a/src/async_connection.cpp b/src/async_connection.cpp index 2451e1a..be1a248 100644 --- a/src/async_connection.cpp +++ b/src/async_connection.cpp @@ -199,7 +199,7 @@ namespace redis { return connected; } - boost::string_ref AsyncConnection::connection_error() const { + boost::string_view AsyncConnection::connection_error() const { return m_local_data->connect_err_msg; } diff --git a/src/async_connection.hpp b/src/async_connection.hpp index bf6cfd3..1817466 100644 --- a/src/async_connection.hpp +++ b/src/async_connection.hpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include struct redisAsyncContext; struct ev_loop; @@ -44,7 +44,7 @@ namespace redis { void wait_for_disconnect ( void ); bool is_connected ( void ) const; - boost::string_ref connection_error ( void ) const; + boost::string_view connection_error ( void ) const; void wakeup_event_thread ( void ); std::mutex& event_mutex ( void ); redisAsyncContext* connection ( void ); diff --git a/src/command.cpp b/src/command.cpp index 64da10e..53b35bd 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -77,7 +77,7 @@ namespace redis { return m_local_data->async_connection.is_connected(); } - boost::string_ref Command::connection_error() const { + boost::string_view Command::connection_error() const { return m_local_data->async_connection.connection_error(); } diff --git a/src/incredis.cpp b/src/incredis.cpp index 62199f6..19c8d2a 100644 --- a/src/incredis.cpp +++ b/src/incredis.cpp @@ -81,45 +81,45 @@ namespace redis { return m_command.make_batch(); } - auto IncRedis::scan (boost::string_ref parPattern) -> scan_range { + auto IncRedis::scan (boost::string_view parPattern) -> scan_range { return scan_range(scan_iterator(&m_command, false, parPattern), scan_iterator(&m_command, true)); } - auto IncRedis::hscan (boost::string_ref parKey, boost::string_ref parPattern) -> hscan_range { + auto IncRedis::hscan (boost::string_view parKey, boost::string_view parPattern) -> hscan_range { return hscan_range(hscan_iterator(&m_command, parKey, false, parPattern), hscan_iterator(&m_command, parKey, true)); } - auto IncRedis::sscan (boost::string_ref parKey, boost::string_ref parPattern) -> sscan_range { + auto IncRedis::sscan (boost::string_view parKey, boost::string_view parPattern) -> sscan_range { return sscan_range(sscan_iterator(&m_command, parKey, false, parPattern), sscan_iterator(&m_command, parKey, true)); } - auto IncRedis::zscan (boost::string_ref parKey, boost::string_ref parPattern) -> zscan_range { + auto IncRedis::zscan (boost::string_view parKey, boost::string_view parPattern) -> zscan_range { return zscan_range(zscan_iterator(&m_command, parKey, false, parPattern), zscan_iterator(&m_command, parKey, true)); } - auto IncRedis::hget (boost::string_ref parKey, boost::string_ref parField) -> opt_string { + auto IncRedis::hget (boost::string_view parKey, boost::string_view parField) -> opt_string { return optional_string(m_command.run("HGET", parKey, parField)); } - int IncRedis::hincrby (boost::string_ref parKey, boost::string_ref parField, int parInc) { + int IncRedis::hincrby (boost::string_view parKey, boost::string_view parField, int parInc) { const auto inc = dhandy::lexical_cast(parInc); auto reply = m_command.run("HINCRBY", parKey, parField, inc); return get_integer(reply); } - auto IncRedis::srandmember (boost::string_ref parKey, int parCount) -> opt_string_list { + auto IncRedis::srandmember (boost::string_view parKey, int parCount) -> opt_string_list { return optional_string_list(m_command.run("SRANDMEMBER", parKey, dhandy::lexical_cast(parCount))); } - auto IncRedis::srandmember (boost::string_ref parKey) -> opt_string { + auto IncRedis::srandmember (boost::string_view parKey) -> opt_string { return optional_string(m_command.run("SRANDMEMBER", parKey)); } - auto IncRedis::smembers (boost::string_ref parKey) -> opt_string_list { + auto IncRedis::smembers (boost::string_view parKey) -> opt_string_list { return optional_string_list(m_command.run("SMEMBERS", parKey)); } - auto IncRedis::zrangebyscore (boost::string_ref parKey, double parMin, bool parMinIncl, double parMax, bool parMaxIncl, bool parWithScores) -> opt_string_list { + auto IncRedis::zrangebyscore (boost::string_view parKey, double parMin, bool parMinIncl, double parMax, bool parMaxIncl, bool parWithScores) -> opt_string_list { auto batch = make_batch(); batch.zrangebyscore(parKey, parMin, parMinIncl, parMax, parMaxIncl, parWithScores); assert(batch.replies().size() == 1); @@ -141,7 +141,7 @@ namespace redis { return ret; } - bool IncRedis::expire (boost::string_ref parKey, RedisInt parTTL) { + bool IncRedis::expire (boost::string_view parKey, RedisInt parTTL) { const auto ret = redis::get(m_command.run("EXPIRE", parKey, dhandy::lexical_cast(parTTL))); return (ret == 1 ? true : false); } @@ -150,11 +150,11 @@ namespace redis { return optional_string_list(parReply); } - auto IncRedis::get (boost::string_ref parKey) -> opt_string { + auto IncRedis::get (boost::string_view parKey) -> opt_string { return optional_string(m_command.run("GET", parKey)); } - bool IncRedis::set (boost::string_ref parKey, boost::string_ref parField) { + bool IncRedis::set (boost::string_view parKey, boost::string_view parField) { auto batch = make_batch(); batch.set(parKey, parField, IncRedisBatch::ADD_None); assert(batch.replies().size() == 1); @@ -162,7 +162,7 @@ namespace redis { return ret.is_ok(); } - RedisInt IncRedis::incr (boost::string_ref parKey) { + RedisInt IncRedis::incr (boost::string_view parKey) { const auto ret = redis::get(m_command.run("INCR", parKey)); return ret; } diff --git a/src/incredis_batch.cpp b/src/incredis_batch.cpp index 9d61f9f..0c5626a 100644 --- a/src/incredis_batch.cpp +++ b/src/incredis_batch.cpp @@ -49,32 +49,32 @@ namespace redis { return *this; } - IncRedisBatch& IncRedisBatch::client_setname (boost::string_ref parName) { + IncRedisBatch& IncRedisBatch::client_setname (boost::string_view parName) { m_batch.run("CLIENT", "SETNAME", parName); return *this; } - IncRedisBatch& IncRedisBatch::hget (boost::string_ref parKey, boost::string_ref parField) { + IncRedisBatch& IncRedisBatch::hget (boost::string_view parKey, boost::string_view parField) { m_batch.run("HGET", parKey, parField); return *this; } - IncRedisBatch& IncRedisBatch::hincrby (boost::string_ref parKey, boost::string_ref parField, int parInc) { + IncRedisBatch& IncRedisBatch::hincrby (boost::string_view parKey, boost::string_view parField, int parInc) { m_batch.run("HINCRBY", parKey, parField, dhandy::lexical_cast(parInc)); return *this; } - IncRedisBatch& IncRedisBatch::srandmember (boost::string_ref parKey, int parCount) { + IncRedisBatch& IncRedisBatch::srandmember (boost::string_view parKey, int parCount) { m_batch.run("SRANDMEMBER", parKey, dhandy::lexical_cast(parCount)); return *this; } - IncRedisBatch& IncRedisBatch::srandmember (boost::string_ref parKey) { + IncRedisBatch& IncRedisBatch::srandmember (boost::string_view parKey) { m_batch.run("SRANDMEMBER", parKey); return *this; } - IncRedisBatch& IncRedisBatch::set (boost::string_ref parKey, boost::string_ref parField, ADD_Mode parMode) { + IncRedisBatch& IncRedisBatch::set (boost::string_view parKey, boost::string_view parField, ADD_Mode parMode) { switch(parMode) { case ADD_None: m_batch.run("SET", parKey, parField); @@ -89,7 +89,7 @@ namespace redis { return *this; } - IncRedisBatch& IncRedisBatch::zrangebyscore (boost::string_ref parKey, double parMin, bool parMinIncl, double parMax, bool parMaxIncl, bool parWithScores) { + IncRedisBatch& IncRedisBatch::zrangebyscore (boost::string_view parKey, double parMin, bool parMinIncl, double parMax, bool parMaxIncl, bool parWithScores) { auto lower_bound = make_boundary(parMin, not parMinIncl); auto upper_bound = make_boundary(parMax, not parMaxIncl); diff --git a/src/scan_iterator.cpp b/src/scan_iterator.cpp index 6758988..8695951 100644 --- a/src/scan_iterator.cpp +++ b/src/scan_iterator.cpp @@ -25,11 +25,11 @@ namespace redis { namespace implem { ScanIteratorBaseClass::ScanIteratorBaseClass (Command* parCommand) : - ScanIteratorBaseClass(parCommand, boost::string_ref()) + ScanIteratorBaseClass(parCommand, boost::string_view()) { } - ScanIteratorBaseClass::ScanIteratorBaseClass (Command* parCommand, boost::string_ref parMatchPattern) : + ScanIteratorBaseClass::ScanIteratorBaseClass (Command* parCommand, boost::string_view parMatchPattern) : m_command(parCommand), m_match_pattern(parMatchPattern) { @@ -50,7 +50,7 @@ namespace redis { return m_command->run(parCommand, scan_context, "MATCH", m_match_pattern, "COUNT", count_hint); } - Reply ScanIteratorBaseClass::run (const char* parCommand, const boost::string_ref& parParameter, RedisInt parScanContext, std::size_t parCount) { + Reply ScanIteratorBaseClass::run (const char* parCommand, const boost::string_view& parParameter, RedisInt parScanContext, std::size_t parCount) { const auto scan_context = dhandy::lexical_cast(parScanContext); const auto count_hint = dhandy::lexical_cast(parCount); if (m_match_pattern.empty()) diff --git a/src/script.cpp b/src/script.cpp index 06d58e3..57f93ce 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -24,7 +24,7 @@ namespace redis { { } - Script::Script (boost::string_ref parSha1, ScriptManager& parManager) : + Script::Script (boost::string_view parSha1, ScriptManager& parManager) : m_sha1(parSha1), m_manager(&parManager) { diff --git a/src/script_manager.cpp b/src/script_manager.cpp index 3f34966..45c7ef8 100644 --- a/src/script_manager.cpp +++ b/src/script_manager.cpp @@ -45,11 +45,11 @@ namespace redis { } #if defined(MAKE_SHA1_WITH_CRYPTOPP) - boost::string_ref ScriptManager::add_lua_script_ifn (const std::string& parScript) { + boost::string_view ScriptManager::add_lua_script_ifn (const std::string& parScript) { assert(m_command->is_connected()); if (parScript.empty()) - return boost::string_ref(); + return boost::string_view(); using dhandy::lexical_cast; @@ -75,7 +75,7 @@ namespace redis { auto it_found = m_known_hashes.find(sha1_array); const bool was_present = (m_known_hashes.end() != it_found); if (was_present) { - return boost::string_ref(it_found->data(), it_found->size()); + return boost::string_view(it_found->data(), it_found->size()); } auto reply = m_command->run("SCRIPT", "LOAD", parScript); @@ -85,16 +85,16 @@ namespace redis { const auto it_inserted = m_known_hashes.insert(it_found, sha1_array); (void)reply; - return boost::string_ref(it_inserted->data(), it_inserted->size()); + return boost::string_view(it_inserted->data(), it_inserted->size()); } #else - boost::string_ref ScriptManager::add_lua_script_ifn (const std::string& parScript) { + boost::string_view ScriptManager::add_lua_script_ifn (const std::string& parScript) { assert(m_command->is_connected()); auto it_found = m_known_scripts.find(parScript); const bool was_present = (m_known_scripts.end() != it_found); if (was_present) { - return boost::string_ref(it_found->second.data(), it_found->second.size()); + return boost::string_view(it_found->second.data(), it_found->second.size()); } auto reply = m_command->run("SCRIPT", "LOAD", parScript); @@ -105,7 +105,7 @@ namespace redis { std::copy(sha1_str.begin(), sha1_str.end(), sha1_array.begin()); auto it_inserted = m_known_scripts.insert(it_found, std::make_pair(parScript, sha1_array)); - return boost::string_ref(it_inserted->second.data(), it_inserted->second.size()); + return boost::string_view(it_inserted->second.data(), it_inserted->second.size()); } #endif } //namespace redis