URI::redis(3)
π URI::redis(3) β URI for Redis connection info π
okay bestie, welcome to the URI::redis manual page π
this is User Contributed Perl Documentation, and itβs literally here to explain the URI class for Redis connection info. no cap, itβs giving very specific but very useful β¨
β¨ NAME β¨
URI::redis β URI for Redis connection info π«Ά
π SYNOPSIS π
use URI::redis;
$url = URI->new('redis://redis.example.com?password=correcthorsebatterystaple');
$url = URI->new('redis://redis.example.com?db=5&password=correcthorsebatterystaple');
$url = URI->new('redis+unix:///tmp/redis.sock?db=5&password=correcthorsebatterystaple');
π DESCRIPTION π
The URI::redis class supports URI objects belonging to the redis and redis+unix URI scheme. πΈ
Those URLs are used to encode connection info to Redis servers β for redis thatβs host, port, password, database, and for redis+unix thatβs socket path, password, database. iconic, honestly π
Supported URLs are in any of these formats:
The TCP connection crew β and yes, the port defaults to 6379 and the host defaults to "localhost" β see <http://www.iana.org/assignments/uri-schemes/prov/redis>:
"redis://HOST[:PORT][?db=DATABASE[&password=PASSWORD]]""redis://HOST[:PORT][?password=PASSWORD[&db=DATABASE]]""redis://[:PASSWORD@]HOST[:PORT][/DATABASE]""redis://[:PASSWORD@]HOST[:PORT][?db=DATABASE]""redis://HOST[:PORT]/DATABASE[?password=PASSWORD]"
The Unix domain socket crew π¬
"redis+unix://[:PASSWORD@]SOCKET_PATH[?db=DATABASE]""redis+unix://SOCKET_PATH[?db=DATABASE[&password=PASSWORD]]""redis+unix://SOCKET_PATH[?password=PASSWORD[&db=DATABASE]]"
A Unix domain socket connection. π¦
π οΈ METHODS π οΈ
In addition to the methods inherited from URI, it provides the following methods:
ποΈ database ποΈ
Returns the database number from the path or the db query param.
Returns 0 if no database is specified. β¨
π§ database_from_path π§
Returns the database number encoded in the path part of the URI. Only works if the path is in the format "^ / \d+".
Returns undef if no database can be parsed from the path.
π database_from_query π
Returns the database number from the db query param.
Returns undef if no db query param, or it has no value set.
π password π
Returns the password from the userinfo or the password query param.
π«Ά password_from_userinfo π«Ά
Returns the password part of the userinfo in URI.
π password_from_query π
Returns the password from the password query param.
𧦠socket_path π§¦
Returns the Unix domain socket path.
Returns undef if the URI is not of the 'redis+unix' scheme.
π SEE ALSO π
URI β the whole reason this class can inherit all its main-character energy π
Β©οΈ COPYRIGHT Β©οΈ
Copyright 2016 Norbert Buchmueller.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π and thatβs the page, bestie β brought to you by perl v5.42.2, dated 2026-02-15, filed under URI::redis(3). slay β¨
π¦ where this page comes from
- alpine 3.24: perl-uri-redis-doc 0.02-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms