From 37619bae778183159beee455a5f0d2a0fe02a883 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Wed, 10 May 2017 09:29:08 -0300 Subject: [PATCH] Removes local cache for transformations --- src/actions/transformations/lower_case.h | 18 ------------------ src/actions/transformations/url_decode.cc | 6 ------ src/actions/transformations/url_decode.h | 18 ------------------ 3 files changed, 42 deletions(-) diff --git a/src/actions/transformations/lower_case.h b/src/actions/transformations/lower_case.h index 901333d4..41e81761 100644 --- a/src/actions/transformations/lower_case.h +++ b/src/actions/transformations/lower_case.h @@ -29,24 +29,6 @@ class Transaction; namespace actions { namespace transformations { -class LowerCaseInstantCache : - public std::unordered_map { - public: - static LowerCaseInstantCache& getInstance() { - static LowerCaseInstantCache instance; - return instance; - } - - void cache(const std::string& value, const std::string& out) { - emplace(value, out); - if (size() > 100) { - erase(begin()); - } - } - private: - LowerCaseInstantCache() {} -}; - class LowerCase : public Transformation { public: diff --git a/src/actions/transformations/url_decode.cc b/src/actions/transformations/url_decode.cc index 8ed788a2..82706d7e 100644 --- a/src/actions/transformations/url_decode.cc +++ b/src/actions/transformations/url_decode.cc @@ -43,10 +43,6 @@ std::string UrlDecode::evaluate(std::string value, int invalid_count; int changed; - if (UrlDecodeInstantCache::getInstance().count(value) > 0) { - return UrlDecodeInstantCache::getInstance().at(value); - } - val = (unsigned char *) malloc(sizeof(char) * value.size() + 1); memcpy(val, value.c_str(), value.size() + 1); val[value.size()] = '\0'; @@ -59,8 +55,6 @@ std::string UrlDecode::evaluate(std::string value, free(val); - UrlDecodeInstantCache::getInstance().cache(value, out); - return out; } diff --git a/src/actions/transformations/url_decode.h b/src/actions/transformations/url_decode.h index eda1e3b9..9777153b 100644 --- a/src/actions/transformations/url_decode.h +++ b/src/actions/transformations/url_decode.h @@ -29,24 +29,6 @@ class Transaction; namespace actions { namespace transformations { -class UrlDecodeInstantCache : - public std::unordered_map { - public: - static UrlDecodeInstantCache& getInstance() { - static UrlDecodeInstantCache instance; - return instance; - } - - void cache(const std::string& value, const std::string& out) { - emplace(value, out); - if (size() > 500) { - erase(begin()); - } - } - private: - UrlDecodeInstantCache() {} -}; - class UrlDecode : public Transformation { public: