Limit the amount of transformations inside the cache storage

This commit is contained in:
Felipe Zimmerle
2015-11-04 16:20:31 -03:00
parent 5bef19aa4d
commit 45638ccc91
6 changed files with 21 additions and 3 deletions

View File

@@ -36,6 +36,12 @@ class UrlDecodeInstantCache : public std::unordered_map<std::string, std::string
return instance;
}
void cache(const std::string& value, const std::string& out) {
emplace(value, out);
if (size() > 100) {
erase(begin());
}
}
private:
UrlDecodeInstantCache() {};
};