Copilot commented on code in PR #13893:
URL: https://github.com/apache/trafficserver/pull/13893#discussion_r4366061256


##########
src/iocore/cache/RamCacheCLFUS.cc:
##########
@@ -775,10 +799,18 @@ RamCacheCLFUS::put(CryptoHash *key, IOBufferData *data, 
uint32_t len, bool copy,
   if (!this->_max_bytes) {
     return 0;
   }
+  ink_hrtime now = ink_get_hrtime();
+  if (now - this->_last_decay_time > HRTIME_SECONDS(30)) {
+    if (this->_last_decay_time != 0) {
+      this->_decay_epoch();
+    }
+    this->_last_decay_time = now;

Review Comment:
   The clock advances only once after any gap over 30 seconds, so an untouched 
entry with 64 hits decays to 32 after 95 seconds instead of 8; hit-only traffic 
never advances it because `get()` only applies pending decay. Advance the clock 
in O(1) from both `get()` and `put()`, accounting for every elapsed interval 
and preserving the fractional remainder. Add timer-driven regressions for 
multi-interval gaps and hit-only traffic.



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