Removes local cache for transformations

This commit is contained in:
Felipe Zimmerle 2017-05-10 09:29:08 -03:00
parent 0e05b7bb8a
commit 37619bae77
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277
3 changed files with 0 additions and 42 deletions

View File

@ -29,24 +29,6 @@ class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
class LowerCaseInstantCache :
public std::unordered_map<std::string, std::string> {
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 { class LowerCase : public Transformation {
public: public:

View File

@ -43,10 +43,6 @@ std::string UrlDecode::evaluate(std::string value,
int invalid_count; int invalid_count;
int changed; int changed;
if (UrlDecodeInstantCache::getInstance().count(value) > 0) {
return UrlDecodeInstantCache::getInstance().at(value);
}
val = (unsigned char *) malloc(sizeof(char) * value.size() + 1); val = (unsigned char *) malloc(sizeof(char) * value.size() + 1);
memcpy(val, value.c_str(), value.size() + 1); memcpy(val, value.c_str(), value.size() + 1);
val[value.size()] = '\0'; val[value.size()] = '\0';
@ -59,8 +55,6 @@ std::string UrlDecode::evaluate(std::string value,
free(val); free(val);
UrlDecodeInstantCache::getInstance().cache(value, out);
return out; return out;
} }

View File

@ -29,24 +29,6 @@ class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
class UrlDecodeInstantCache :
public std::unordered_map<std::string, std::string> {
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 { class UrlDecode : public Transformation {
public: public: