Index Documentation

ValkeyBackend
in package
implements CacheBackend

Information about the Valkey backend.

Also compatible with Redis and KeyDB.

Table of Contents

Interfaces

CacheBackend
Information about a cache provider. Should not have any external dependencies.

Methods

createProvider()  : ValkeyProvider
Creates a Valkey cache provider.
isAvailable()  : bool
Checks whether the driver is available and a provider can be made.
parseDsn()  : ValkeyProviderInfo
Constructs a cache info instance from a dsn.

Methods

isAvailable()

Checks whether the driver is available and a provider can be made.

public isAvailable() : bool
Return values
bool

If true a provider can be made, if false a required extension is missing.

parseDsn()

Constructs a cache info instance from a dsn.

public parseDsn(string|array<string, int|string> $dsn) : ValkeyProviderInfo

The Valkey backend supports setting a username and password in the URL. //username:password@ is treated as a username and password. //username@ is treated as just a password despite what is normally expected of a URL. Older versions of Redis did not have the concept of usernames. In order to still use a username but no password for some reason you can specify //username:@, just inserting a colon without anything after it.

The host part of the URL can be any DNS name, or special value :unix:, documented further down.

The path part of the URL is used as a key prefix. Any prefix slashes (/) are trimmed and others are converted to a colon (:). Meaning /prefix/test/ is converted to prefix:test:.

In order to use a Unix socket path, set the host part to :unix: and specify socket=/path/to/socket.sock in the query.

Other query fields include:

  • db=<number>: Allows you to select a different database.
  • persist: Uses a persistent connection.
Parameters
$dsn : string|array<string, int|string>

DSN with provider information.

Return values
ValkeyProviderInfo

Valkey provider info instance.


        
On this page

Search results