-
Notifications
You must be signed in to change notification settings - Fork 598
Add DistributedCacheEventStreamStore
#1136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mbuck/resumability-redelivery
Are you sure you want to change the base?
Add DistributedCacheEventStreamStore
#1136
Conversation
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.Extensions.AI.Abstractions" /> | ||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" /> | ||
| <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ModelContextProtocol.Core the right assembly for this, or should it instead live in ModelContextProtocol or ModelContextProtocol.AspNetCore?
| streamId = string.Empty; | ||
| sequence = 0; | ||
|
|
||
| var parts = eventId.Split(Separator); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Core you could use the span-based Split, which would avoid the string[] and also avoid needing to materialize strings for parts[0]/[1]/[2].
| // Base64-encode session and stream IDs so the event ID can be parsed | ||
| // even if the original IDs contain the ':' separator character | ||
| var sessionBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionId)); | ||
| var streamBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(streamId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate from this PR, we should really add Base64 overloads that handle this without the intermediate byte[]. I will follow up.
| /// </summary> | ||
| internal static class CacheKeys | ||
| { | ||
| private const string Prefix = "mcp:sse:"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wanted to ship a new version that breaks the caching format and thus should ignore existing entries, how would we version it? change this prefix to include a version number?
Opening initially as a draft until #1077 gets merged