Skip to content

feat(cache): Lookup Cache Phase 2 — 多庫、SelectList、全域 TenantIsolation (Closes #142)#144

Merged
cct08311github merged 1 commit intodotnet8from
issue-142-lookup-phase2
Mar 10, 2026
Merged

feat(cache): Lookup Cache Phase 2 — 多庫、SelectList、全域 TenantIsolation (Closes #142)#144
cct08311github merged 1 commit intodotnet8from
issue-142-lookup-phase2

Conversation

@cct08311github
Copy link
Copy Markdown
Owner

Summary

Phase 2 improvements based on BMS production integration feedback:

  • IReadOnlyList return type — prevent accidental cache mutation by callers
  • ConnectionKey — multi-DB support ([CacheLookup(ConnectionKey = "orss")]) for models in secondary databases
  • Global TenantIsolation — single-tenant apps can set DefaultTenantIsolation = false once instead of per-model
  • GetLookupItem<T> — single-item lookup by predicate
  • GetLookupSelectList<T> — dropdown integration via ComboSelectListItem
  • Docs — stampede protection note, filter semantics, EmptyContext caveat

Closes #142

Test plan

  • 7 new tests: IReadOnlyList, GetAttribute, DefaultTenantIsolation, ConnectionKey
  • All 456 tests pass (0 failures)
  • Existing 22 Cache tests unaffected

🤖 Generated with Claude Code

…bal TenantIsolation, helper methods (Closes #142)

- Change GetAll/GetAllAsync return type from List<T> to IReadOnlyList<T> to prevent accidental cache mutation
- Add ConnectionKey property to [CacheLookup] for multi-database support (e.g. ORSS read-only DB)
- Change TenantIsolation to three-state (unset/true/false) with global default via LookupCacheOptions
- Add GetLookupItem<T> for single-item lookup by predicate
- Add GetLookupSelectList<T> for dropdown integration (ComboSelectListItem)
- Add GetAttribute and DefaultTenantIsolation to ILookupCacheService
- Update CacheLookupAttribute remarks to reference FrameworkContext.SaveChanges
- Update docs with new features, stampede protection note, filter semantics, EmptyContext caveat
- Add 7 new tests covering IReadOnlyList, GetAttribute, DefaultTenantIsolation, ConnectionKey

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@cct08311github cct08311github merged commit 0030261 into dotnet8 Mar 10, 2026
4 checks passed
@cct08311github cct08311github deleted the issue-142-lookup-phase2 branch March 20, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cache): Lookup Cache Phase 2 — 多庫支援、SelectList、全域 TenantIsolation、IReadOnlyList、by-ID

1 participant