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


##########
extensions/windows-event-log/wel/WindowsEventLog.cpp:
##########
@@ -42,6 +42,18 @@ std::string getEventTimestampStr(uint64_t event_timestamp) {
 }
 }  // namespace
 
+std::optional<std::string> EventDataCache::get(EVT_FORMAT_MESSAGE_FLAGS field, 
const std::string& key) {
+    std::lock_guard<std::mutex> lock{mutex_};
+    const auto it = cache_.find(std::make_tuple(field, key));
+    if (it != cache_.end() && it->second.expiry > 
std::chrono::system_clock::now()) { return it->second.value; }

Review Comment:
   There is a fairly small set of possible cache keys; also, if the lookup 
fails because of cache expiry, we will replace the expired value with a new 
cache item in `WindowsEventLogHandler::getEventData()`.



-- 
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