fgerlits commented on code in PR #1985:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1985#discussion_r2175689944
##########
extensions/windows-event-log/wel/WindowsEventLog.h:
##########
@@ -58,12 +67,27 @@ enum METADATA {
COMPUTER,
UNKNOWN
};
-
-
// this is a continuous enum, so we can rely on the array
-
using METADATA_NAMES = std::vector<std::pair<METADATA, std::string>>;
+class EventDataCache {
+ public:
+ explicit EventDataCache(std::chrono::milliseconds lifetime =
std::chrono::hours{24})
+ : lifetime_(lifetime) {}
+ std::optional<std::string> get(EVT_FORMAT_MESSAGE_FLAGS field, const
std::string& key);
+ void set(EVT_FORMAT_MESSAGE_FLAGS field, const std::string& key, std::string
value);
+
+ private:
+ struct CacheItem {
+ std::string value;
+ std::chrono::system_clock::time_point expiry;
+ };
+
+ std::mutex mutex_;
+ std::chrono::milliseconds lifetime_;
+ std::unordered_map<std::tuple<EVT_FORMAT_MESSAGE_FLAGS, std::string>,
CacheItem> cache_;
Review Comment:
done: b7d5e1253542941262e4a90342f6c1bbab3c86ca
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]