Skip to content

Latest commit

 

History

History
108 lines (80 loc) · 4.32 KB

File metadata and controls

108 lines (80 loc) · 4.32 KB

Valkey PHP - Introspection

Command Description Supported Tested Class/Trait Method
isConnected A method to determine if a phpredis object thinks it's connected to a server. Introspection isConnected
getHost Retrieve our host or unix socket that we're connected to. Introspection getHost
getPort Get the port we're connected to. Introspection getPort
getDbNum Get the database number phpredis is pointed to. Introspection getDbNum
getTimeout Get the (write) timeout in use for phpredis. Introspection getTimeout
getReadTimeout Get the read timeout specified to phpredis or FALSE if we're not connected. Introspection getReadTimeout
getPersistentID Gets the persistent ID that phpredis is using. Introspection getPersistentID
getAuth Get the password used to authenticate the phpredis connection. Introspection getAuth

Usage

$valkey = new Valkey();
$valkey->connect('127.0.0.1', 6379);
$valkey->isConnected();
$valkey->getHost();
$valkey->getPort();
$valkey->getDbNum();
$valkey->getTimeout();
$valkey->getReadTimeout();
$valkey->getPersistentID();
$valkey->getAuth();

isConnected


Description: A method to determine if a valkey-php object thinks it's connected to a server

Parameters

None

Return value

Boolean Returns TRUE if valkey-php thinks it's connected and FALSE if not

getHost


Description: Retrieve our host or unix socket that we're connected to

Parameters

None

Return value

Mixed The host or unix socket we're connected to or FALSE if we're not connected

getPort


Description: Get the port we're connected to

Parameters

None

Return value

Mixed Returns the port we're connected to or FALSE if we're not connected

getDbNum


Description: Get the database number valkey-php is pointed to

Parameters

None

Return value

Mixed Returns the database number (LONG) valkey-php thinks it's pointing to or FALSE if we're not connected

getTimeout


Description: Get the (write) timeout in use for valkey-php

Parameters

None

Return value

Mixed The timeout (DOUBLE) specified in our connect call or FALSE if we're not connected

getReadTimeout

Description: Get the read timeout specified to valkey-php or FALSE if we're not connected

Parameters

None

Return value

Mixed Returns the read timeout (which can be set using setOption and Valkey::OPT_READ_TIMEOUT) or FALSE if we're not connected

getPersistentID


Description: Gets the persistent ID that valkey-php is using

Parameters

None

Return value

Mixed Returns the persistent id valkey-php is using (which will only be set if connected with pconnect), NULL if we're not using a persistent ID, and FALSE if we're not connected

getAuth


Description: Get the password (or username and password if using Valkey 6 ACLs) used to authenticate the connection.

Parameters

None

Return value

Mixed Returns NULL if no username/password are set, the password string if a password is set, and a [username, password] array if authenticated with a username and password.