Merged
Conversation
This is to prepare for new NATS .NET 2.7 release where this feature is removed because it is problematic on buckets with history >1.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a custom implementation of PutWithTtlAsync to prepare for NATS .NET 2.7, which removes this feature due to issues with buckets that have history > 1. The implementation provides extension methods for putting key-value pairs with optional time-to-live (TTL) support.
Key Changes:
- Added
NatsExtensionsclass withPutWithTtlAsyncandTryPutWithTtlAsyncextension methods forINatsKVStore - Replaced the call to the deprecated
PutAsyncmethod with the newPutWithTtlAsyncextension method inNatsCache - Added comprehensive integration tests covering happy paths, TTL expiration, key validation, and error cases
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/NatsDistributedCache/NatsExtensions.cs | New extension methods providing PutWithTtl functionality with key validation and TTL header support |
| src/NatsDistributedCache/NatsCache.cs | Updated to use the new PutWithTtlAsync extension method instead of the deprecated PutAsync |
| test/IntegrationTests/Extensions/NatsExtensionsPutWithTtlTests.cs | Comprehensive integration tests for the new extension methods covering various scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
caleblloyd
approved these changes
Dec 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is to prepare for new NATS .NET 2.7 release where this feature is removed because it is problematic on buckets with history >1.