Skip to content

Commit a89459b

Browse files
authored
refactor(common): deprecate unused memory-safe lru map. (#7553)
1 parent c434f4d commit a89459b

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎RELEASE-NOTES.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
### API Changes
44

5+
- `MemorySafeLRUMap` is deprecated since 2.7.2. The class, public constructors,
6+
serialization identifier and existing behavior are retained for downstream
7+
source and binary compatibility. No removal release is scheduled; a future
8+
removal requires a public API compatibility review and advance release notice.
9+
For caches accessed through the `Map` API, consider the existing
10+
`WindowTinyLFUMap` with an explicit maximum entry count, for example
11+
`new WindowTinyLFUMap<>(maximumEntries)`. Choose that count for the application's
12+
working set: the old `maxFreeMemory` argument is a free-memory threshold in
13+
bytes, not an entry count. Review the different eviction policy, non-null
14+
key/value requirements and absence of `LRUMap`-specific operations. Code that
15+
relies on memory-pressure eviction should retain `MemorySafeLRUMap` until an
16+
equivalent policy is chosen; `WindowTinyLFUMap` does not implement that
17+
threshold. (#7444)
18+
519
- `DiscoveryUpstreamDataSubscriber#unSubscribe(DiscoverySyncData)` has been replaced by `unSubscribe(DiscoveryUpstreamKey)`. Downstream implementations must update their method signature; this is a source- and binary-incompatible change. (#7289)
620

721
### Behavior Changes

‎shenyu-common/src/main/java/org/apache/shenyu/common/cache/MemorySafeLRUMap.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
* is that it handles memory issues via {@link org.apache.shenyu.common.concurrent.MemoryLimitCalculator}.
2929
*
3030
* <p>Note: this class is not thread safe! see https://github.com/apache/shenyu/issues/3929
31+
*
32+
* @deprecated since 2.7.2, retained for downstream compatibility. For bounded caches accessed through
33+
* the {@link Map} API, consider {@link WindowTinyLFUMap} with an explicit maximum entry count.
34+
* Review its different eviction policy and lack of this class's free-memory threshold
35+
* and {@link LRUMap}-specific operations before migrating.
3136
*/
37+
@Deprecated(since = "2.7.2")
3238
@NotThreadSafe
3339
public class MemorySafeLRUMap<K, V> extends LRUMap<K, V> {
3440

0 commit comments

Comments
 (0)