Skip to content

Conversation

@zenyanle
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

Currently, the memcached service only supports TCP connections. However, in many local or containerized environments, connecting via Unix Domain Sockets (UDS) is preferred for better performance or security.

This PR introduces support for UDS and refactors the connection logic to handle different transport protocols uniformly.

What changes are included in this PR?

  • Dependency Update: Switched from http to url crate for more flexible endpoint parsing (specifically for non-HTTP schemes like unix).
  • New Abstraction: Introduced SocketStream enum to unify TcpStream and UnixStream implementations under AsyncRead and AsyncWrite.
  • Builder Update: Updated the builder to parse unix:// schemes and support local socket paths.
  • Backward Compatibility: Maintained support for scheme-less endpoints (defaulting to TCP) to ensure existing configurations continue to work.

Are there any user-facing changes?

Yes. Users can now configure the endpoint with the unix scheme to connect via a Unix Domain Socket.

Example:

  • unix:///tmp/memcached.sock

Existing TCP configurations (e.g., 127.0.0.1:11211) remain unaffected.

AI Usage Statement

This PR was developed with assistance from GitHub Copilot (Claude Opus 4.5).

- Switch dependency from `http` to `url` for endpoint parsing.
- Introduce `SocketStream` to handle both `TcpStream` and `UnixStream`.
@zenyanle zenyanle requested a review from Xuanwo as a code owner December 29, 2025 05:28
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" labels Dec 29, 2025
@zenyanle
Copy link
Contributor Author

zenyanle commented Dec 29, 2025

This is a small change and shouldn't affect existing logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant