From 47ea09ebdf24bfce8c7572372b56081dcf41866d Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Mon, 7 Aug 2017 10:15:30 +0100 Subject: [PATCH] Compose token in c++, not in lua. --- src/kamokan_impl/retrieve_pastie.lua | 4 +--- src/kamokan_impl/storage.cpp | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/kamokan_impl/retrieve_pastie.lua b/src/kamokan_impl/retrieve_pastie.lua index 926cbd1..bcaee3e 100644 --- a/src/kamokan_impl/retrieve_pastie.lua +++ b/src/kamokan_impl/retrieve_pastie.lua @@ -1,6 +1,4 @@ -local token = KEYS[1] -local token_prefix = ARGV[1] -local full_token = token_prefix .. token +local full_token = KEYS[1] local result = redis.call("HMGET", full_token, "pastie", "selfdes", "lang") if false == result[1] then return redis.error_reply("PastieNotFound") diff --git a/src/kamokan_impl/storage.cpp b/src/kamokan_impl/storage.cpp index ac3ec8c..7df414f 100644 --- a/src/kamokan_impl/storage.cpp +++ b/src/kamokan_impl/storage.cpp @@ -191,7 +191,8 @@ namespace kamokan { redis::Script retrieve = m_redis->command().make_script(string_view(g_load_script, g_load_script_size)); auto batch = m_redis->command().make_batch(); - retrieve.run(batch, std::make_tuple(parToken), std::make_tuple(string_view(g_token_prefix))); + std::string token_with_prefix = std::string(g_token_prefix) + std::string(parToken); + retrieve.run(batch, std::make_tuple(token_with_prefix), std::tuple<>()); auto raw_replies = batch.replies(); if (raw_replies.empty()) return retval;