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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to