Commit 5a8a031
committed
[Feat] Add is_user_level property and cache_salt param to EvictionPolicy
Add is_user_level property to EvictionPolicy base class (default False).
The eviction controller uses this to decide whether to check per-user
quotas or aggregate usage — no isinstance checks needed.
Add cache_salt optional parameter to get_eviction_actions(). When set,
user-level policies scope eviction to keys belonging to that user.
Non-user-level policies (LRU, NoOp) accept and ignore the parameter.
This is an interface extension only — no new policies or behavioral
changes. UserLRUEvictionPolicy (follow-up PR) will override
is_user_level to return True and use cache_salt for scoped eviction.
Signed-off-by: royyhuang <royyhuang@gmail.com>
Signed-off-by: royyhuang <roy.y.huang@gmail.com>1 parent cfb5c52 commit 5a8a031
3 files changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
30 | 44 | | |
31 | 45 | | |
32 | 46 | | |
| |||
73 | 87 | | |
74 | 88 | | |
75 | 89 | | |
| 90 | + | |
76 | 91 | | |
77 | 92 | | |
78 | 93 | | |
| |||
88 | 103 | | |
89 | 104 | | |
90 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
91 | 111 | | |
92 | 112 | | |
93 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| |||
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
0 commit comments