lymerin opened a new pull request, #7745:
URL: https://github.com/apache/shenyu/pull/7745

   Fixes #7713.
   
   ### Problem
   
   `MemoryCache` creates a separate Guava cache for each response key and 
stores it in an outer `ConcurrentHashMap`. The configured TTL expires the inner 
response entry, but does not remove the outer key or its cache object.
   
   These outer entries are removed only when the same expired key is queried 
again or the backend is closed.
   
   ### Impact
   
   Traffic that continually introduces distinct response keys retains 
historical keys and cache objects beyond their TTLs. This retention exists even 
after the inner response entries have been cleaned up.
   
   ### Changes
   
   Replace the nested caches with a single Caffeine cache that manages response 
values and their individual expiration times together. Scheduled maintenance 
removes expired entries without requiring another lookup of each key.
   
   Preserve the `ICache` interface and per-entry timeout behavior, keep reads 
from extending TTLs, and clear the cache during close.
   
   Add regression tests for expiration cleanup without key lookups and for 
independent TTLs and same-key replacement.
   
   ### Validation
   
   - Memory cache module: 3 tests passed.
   - Cache handler module: 89 tests passed.
   - No test failures or errors.
   - Checkstyle passed.
   - Memory cache module RAT license check passed.
   
   ### Non-blocking note
   
   This change fixes expired-entry retention. It preserves the existing 
behavior of having no capacity limit for live response entries.
   
   ### Checklist
   
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true`.
   


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