Skip to content

Commit 37619ba

Browse files
author
Felipe Zimmerle
committed
Removes local cache for transformations
1 parent 0e05b7b commit 37619ba

File tree

3 files changed

+0
-42
lines changed

3 files changed

+0
-42
lines changed

src/actions/transformations/lower_case.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@ class Transaction;
2929
namespace actions {
3030
namespace transformations {
3131

32-
class LowerCaseInstantCache :
33-
public std::unordered_map<std::string, std::string> {
34-
public:
35-
static LowerCaseInstantCache& getInstance() {
36-
static LowerCaseInstantCache instance;
37-
return instance;
38-
}
39-
40-
void cache(const std::string& value, const std::string& out) {
41-
emplace(value, out);
42-
if (size() > 100) {
43-
erase(begin());
44-
}
45-
}
46-
private:
47-
LowerCaseInstantCache() {}
48-
};
49-
5032

5133
class LowerCase : public Transformation {
5234
public:

src/actions/transformations/url_decode.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ std::string UrlDecode::evaluate(std::string value,
4343
int invalid_count;
4444
int changed;
4545

46-
if (UrlDecodeInstantCache::getInstance().count(value) > 0) {
47-
return UrlDecodeInstantCache::getInstance().at(value);
48-
}
49-
5046
val = (unsigned char *) malloc(sizeof(char) * value.size() + 1);
5147
memcpy(val, value.c_str(), value.size() + 1);
5248
val[value.size()] = '\0';
@@ -59,8 +55,6 @@ std::string UrlDecode::evaluate(std::string value,
5955

6056
free(val);
6157

62-
UrlDecodeInstantCache::getInstance().cache(value, out);
63-
6458
return out;
6559
}
6660

src/actions/transformations/url_decode.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@ class Transaction;
2929
namespace actions {
3030
namespace transformations {
3131

32-
class UrlDecodeInstantCache :
33-
public std::unordered_map<std::string, std::string> {
34-
public:
35-
static UrlDecodeInstantCache& getInstance() {
36-
static UrlDecodeInstantCache instance;
37-
return instance;
38-
}
39-
40-
void cache(const std::string& value, const std::string& out) {
41-
emplace(value, out);
42-
if (size() > 500) {
43-
erase(begin());
44-
}
45-
}
46-
private:
47-
UrlDecodeInstantCache() {}
48-
};
49-
5032

5133
class UrlDecode : public Transformation {
5234
public:

0 commit comments

Comments
 (0)