Skip to content

fix: defer cache invalidation during transactions and add tenant-aware cache keys#434

Open
tnschneider wants to merge 6 commits into
mainfrom
forks/tschneider/fixes
Open

fix: defer cache invalidation during transactions and add tenant-aware cache keys#434
tnschneider wants to merge 6 commits into
mainfrom
forks/tschneider/fixes

Conversation

@tnschneider
Copy link
Copy Markdown
Collaborator

No description provided.

Terry Schneider added 5 commits May 13, 2026 14:08
…support

- Add ITenantEntityCacheKeyResolver interface and TenantEntityCacheKeyResolver implementation to resolve tenant-specific cache key segments
- Register TenantEntityCacheKeyResolver in service collection for entity cache configurations
- Update DefaultEntityCacheService to incorporate tenant ID segments into cache keys for tenant entities
…is active

- Update EntityFramework and Mongo update/delete services to enroll cache invalidation functions in transaction outbox instead of immediate removal when transaction exists
- Remove redundant cache invalidation from soft delete services since update service handles it
- Add comprehensive unit tests verifying transactional cache invalidation behavior for both EntityFramework and Mongo implementations
- Ensure cache is removed
…vices

- Remove IEntityCacheService parameter and unused cache service discard from EntityFrameworkEntitySoftDeleteService
- Remove IEntityCacheService parameter and unused cache service discard from MongoEntitySoftDeleteService
- Cache invalidation is already handled by update service, making direct cache service dependency redundant
…yCacheKeyResolver

- Replace if-null-throw blocks with inline throw expressions for tenant provider and tenant resolution
- Add explicit public modifier to ITenantEntityCacheKeyResolver interface method
@tnschneider tnschneider marked this pull request as ready for review May 13, 2026 20:45
…vider resolution

- Change TenantEntityCacheKeyMetadata dictionary to static to share metadata across instances
- Update GetTenantIdSegmentAsync delegate signature to accept IServiceProvider parameter instead of capturing it
- Defer service provider resolution until cache key generation time by passing serviceProvider to delegate invocation
- Remove serviceProvider parameter from CreateGetTenantIdSegmentAsync method invocation since
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.

1 participant