Search by

mkorkmaz / redislabs-common

mkorkmaz

Common library for Redislabs Modules. Contains Interfaces, General Exceptions, Abstracts and Traits

Package info

github.com/mkorkmaz/redislabs-common

pkg:composer/mkorkmaz/redislabs-common

Statistics

Installs: 138 125

Dependents: 2

Suggesters: 0

Stars: 3

Open Issues: 0

2.0 2026-09-09 08:56 UTC

This package is auto-updated.

Last update: 2026-09-09 09:43:17 UTC


README

Contains Interfaces, General Exceptions, Abstracts and Traits

CI Coverage Status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License

PhpRedis Cluster

The PhpRedis adapter accepts Redis and RedisCluster. For cluster commands, it supplies the first command argument as the routing key without removing it from the command. JSON.DEBUG MEMORY uses the second argument; JSON.DEBUG HELP and commands without arguments use an empty routing key to select one node. Node commands are not broadcast to all masters.

Raw commands with other key positions (for example, EVAL) need the native RedisCluster API with an explicit routing key. Multi-key commands must use keys in the same hash slot. This change does not add Predis cluster routing.

Run the adapter regression tests without a server:

vendor/bin/phpunit --bootstrap vendor/autoload.php tests/RedisClusterTest.php

Release the cluster routing fix as 2.0.0 before releasing the corresponding redislabs-rejson dependency update.

PHP 8.5 migration

PHP 8.5 or later in the 8.x series is required (^8.5). Development tools and CI now target PHP 8.5. This is a breaking release; publish it as a new major version. The common package must be released as 2.0.0 before the corresponding rejson release.

Command properties now have native types: string $command, array $arguments, and ?Closure $responseCallback. Custom command subclasses must use compatible property types. Convert callable arrays or strings with Closure::fromCallable() before assigning a response callback. Module client references are readonly; create a new module instance to replace its connection.

The refactor uses PHP 8.5 property #[Override] checks, first-class callables in property defaults, and clone($object, $properties) for debug command copies. See the PHP 8.5 migration guide.

Standalone integration tests use REDIS_PORT (default 6379). Run them only against a disposable Redis instance: the existing standalone suite uses FLUSHALL.

REDIS_PORT=16379 vendor/bin/codecept run unit

createWithPredis() now requires Predis\Client (including subclasses), because it uses executeRaw(), which is not part of Predis\ClientInterface. For a custom transport, implement Redislabs\Interfaces\RedisClientInterface and pass that adapter to the module constructor.