Skip to content

Conversation

@mtmk
Copy link
Contributor

@mtmk mtmk commented Dec 11, 2025

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.

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.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 NatsExtensions class with PutWithTtlAsync and TryPutWithTtlAsync extension methods for INatsKVStore
  • Replaced the call to the deprecated PutAsync method with the new PutWithTtlAsync extension method in NatsCache
  • 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.

@caleblloyd caleblloyd merged commit bf694e9 into code-cargo:main Dec 12, 2025
1 check passed
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.

2 participants