Skip to content

Commit a0c8c2f

Browse files
committed
Endpoint: Add support for unix sockets
1 parent edc87b7 commit a0c8c2f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/async/redis/endpoint.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require "io/endpoint"
77
require "io/endpoint/host_endpoint"
88
require "io/endpoint/ssl_endpoint"
9+
require "io/endpoint/unix_endpoint"
910

1011
require_relative "protocol/resp2"
1112
require_relative "protocol/authenticated"
@@ -40,6 +41,11 @@ def self.remote(host, port = 6379, **options)
4041
# URI::Generic.build automatically handles IPv6 addresses correctly:
4142
self.new(URI::Generic.build(scheme: "redis", host: host, port: port), **options)
4243
end
44+
45+
def self.unix(path, **options)
46+
unix_endpoint = ::IO::Endpoint.unix(path, Socket::PF_UNIX)
47+
self.new(URI::Generic.build(scheme: "unix", path:), unix_endpoint, **options)
48+
end
4349

4450
SCHEMES = {
4551
"redis" => URI::Generic,

0 commit comments

Comments
 (0)