You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "szaszm (via GitHub)" <gi...@apache.org> on 2025/08/18 15:24:07 UTC

Re: [PR] MINIFICPP-2576 Improve the performance of ConsumeWindowsEventLog [nifi-minifi-cpp]

szaszm commented on code in PR #1985:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1985#discussion_r2282729865


##########
extensions/windows-event-log/wel/WindowsEventLog.h:
##########
@@ -58,11 +58,38 @@ enum METADATA {
   COMPUTER,
   UNKNOWN
 };
+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) {}
+  [[nodiscard]] std::optional<std::string> get(EVT_FORMAT_MESSAGE_FLAGS field, const std::string& key) const;
+  void set(EVT_FORMAT_MESSAGE_FLAGS field, const std::string& key, std::string value);
 
-// this is a continuous enum, so we can rely on the array
+ private:
+  struct CacheKey {
+    EVT_FORMAT_MESSAGE_FLAGS field;
+    std::string key;
 
-using METADATA_NAMES = std::vector<std::pair<METADATA, std::string>>;
+    [[nodiscard]] bool operator==(const CacheKey& other) const noexcept {
+      return field == other.field && key == other.key;
+    }

Review Comment:
   could this be implemented with an explicitly defaulted operator<=>?



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org