Commit 950b303
Add ToolCacheIndexStore.EvictAsync
Removes a single package's pinned state from _index.json so the next
resolve falls through to a fresh NuGet metadata query, ignoring the
CachedWithRefresh TTL for that package only. The rest of the cache is
preserved.
Motivated by host UIs that want to expose a manual 'update to latest'
button — clearing one pin lets users bypass the 24h cache wait without
flushing the entire index. Before this, callers had to reach for
UpdateAsync(mutator) and reproduce internal schema details: lower-case
the key themselves, build an OrdinalIgnoreCase Dictionary, construct
ToolPackageState, set SchemaVersion. EvictAsync owns all of that.
Semantics:
- Case-insensitive on packageId (the index normalizes to lower-case;
forcing callers to do the same was a trap every consumer hit).
- Idempotent: missing entry returns false without throwing, so the
manual-update UX can call this unconditionally before reconnecting.
- Atomic write inherited from UpdateAsync — partial reads can't observe
a half-evicted state.
Three new unit tests cover the happy path, case-insensitivity, and the
missing-entry no-op. Existing five tests untouched; full suite still
green on both net8.0 and net10.0 (8/8).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent e492489 commit 950b303
2 files changed
Lines changed: 99 additions & 0 deletions
File tree
- src/FieldCure.ToolHost
- tests/FieldCure.ToolHost.Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
127 | 166 | | |
128 | 167 | | |
129 | 168 | | |
Lines changed: 60 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
121 | 181 | | |
0 commit comments