diff --git a/src/backends/redis/script.cpp b/src/backends/redis/script.cpp index af7eeac..d88ec39 100644 --- a/src/backends/redis/script.cpp +++ b/src/backends/redis/script.cpp @@ -18,9 +18,15 @@ #include "script.hpp" namespace redis { + Script::Script() : + m_sha1(), + m_manager(nullptr) + { + } + Script::Script (boost::string_ref parSha1, ScriptManager& parManager) : m_sha1(parSha1), - m_manager(parManager) + m_manager(&parManager) { } } //namespace redis diff --git a/src/backends/redis/script.hpp b/src/backends/redis/script.hpp index e169bf6..033469c 100644 --- a/src/backends/redis/script.hpp +++ b/src/backends/redis/script.hpp @@ -23,12 +23,15 @@ #include "helpers/sequence_bt.hpp" #include #include +#include +#include namespace redis { class ScriptManager; class Script { public: + Script ( void ); Script ( Script&& ) = default; Script ( boost::string_ref parSha1, ScriptManager& parManager ); ~Script ( void ) noexcept = default; @@ -36,12 +39,14 @@ namespace redis { template void run ( Batch& parBatch, const std::tuple& parKeys, const std::tuple& parValues ); + Script& operator= ( Script&& ) = default; + private: template void run_with_indices ( Batch& parBatch, const std::tuple& parKeys, const std::tuple& parValues, dinhelp::bt::index_seq, dinhelp::bt::index_seq ); boost::string_ref m_sha1; - ScriptManager& m_manager; + ScriptManager* m_manager; }; template @@ -62,6 +67,9 @@ namespace redis { static_assert(sizeof...(Keys) == std::tuple_size::value, "Wrong key count"); static_assert(sizeof...(Values) == std::tuple_size::value, "Wrong value count"); + assert(not m_sha1.empty()); + assert(m_manager); + parBatch.run( "EVALSHA", m_sha1,