Merged
Conversation
added 2 commits
May 25, 2025 16:21
Signed-off-by: Caleb Lloyd <caleb@boxbuild.io>
Signed-off-by: Caleb Lloyd <caleb@boxbuild.io>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces key encoding functionality to ensure keys conform with NATS KV key rules. The key changes include:
- Adding a new key encoder implementation (NatsCacheKeyEncoder) with corresponding unit tests.
- Updating NatsCache and its extension registration to utilize the new key encoder.
- Adjusting logging and error handling in key operations.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/UnitTests/KeyEncoder/NatsCacheKeyEncoderTest.cs | Adds comprehensive tests for key encoding and decoding. |
| src/NatsDistributedCache/NatsDistributedCacheExtensions.cs | Updates dependency injection to include the key encoder service. |
| src/NatsDistributedCache/NatsCacheKeyEncoder.cs | Implements the new key encoder that transforms keys to KV-legal forms. |
| src/NatsDistributedCache/NatsCache.cs | Refactors key construction to use the encoded key and removes retry logic. |
| src/NatsDistributedCache/NatsCache.Log.cs | Adjusts logging events and removes the update failure logging. |
| src/NatsDistributedCache/INatsCacheKeyEncoder.cs | Defines the interface for the new key encoder. |
Comments suppressed due to low confidence (1)
src/NatsDistributedCache/NatsCache.cs:259
- The removal of the retry mechanism for handling NatsKVWrongLastRevisionException in GetAndRefreshAsync may impact optimistic concurrency behavior. Consider verifying if this behavior change is intentional or reintroducing a retry strategy to maintain data consistency under concurrent updates.
private async Task<byte[]?> GetAndRefreshAsync(string key, CancellationToken token)
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.
Add Key Encoding to conform with the rules of NATS KV Keys