Skip to content

feat(phpredis): add RedisArray client-side sharding support#758

Open
guillaumedelre wants to merge 2 commits into
snc:masterfrom
guillaumedelre:feat/phpredis-array-support
Open

feat(phpredis): add RedisArray client-side sharding support#758
guillaumedelre wants to merge 2 commits into
snc:masterfrom
guillaumedelre:feat/phpredis-array-support

Conversation

@guillaumedelre
Copy link
Copy Markdown

Summary

  • Adds array: true option under clients.options for phpredis clients
  • Routes to PhpredisClientFactory::createArrayClient() which instantiates a native RedisArray
  • Registers a phpredis_arrayclient class parameter in Configuration (defaults to RedisArray)
  • Strips the phpredis-specific array key before passing options to Predis clients

Test plan

  • New test testPhpRedisArrayOption verifies class, DSNs, alias and options for a RedisArray client
  • Renamed testPhpRedisArrayIsNotSupportedtestPhpRedisMultiDsnWithoutModeThrows with updated error message
  • Updated options assertions in existing tests to include array: false default
  • Full env test suite: 2 pre-existing errors only (missing Redis extension in test container)

Closes #195

Adds support for phpredis native RedisArray, enabling client-side
consistent hashing across multiple Redis nodes without a Redis Cluster
setup.

New `array: true` option under `clients.options` routes to a new
`createArrayClient()` in PhpredisClientFactory. The Configuration class
registers a `phpredis_arrayclient` class parameter defaulting to
`RedisArray`.

Signed-off-by: Guillaume Delré <delre.guillaume@gmail.com>
The 'array' config flag selects the RedisArray client class in
loadPhpredisClient() but was not unset before passing options to the
service Definition, causing it to leak into the factory.

Also suppresses an InvalidArgument on RedisArray::setOption() where
the Psalm callmap incorrectly types the value argument as string while
phpredis accepts int for OPT_SERIALIZER at runtime.

Signed-off-by: Guillaume Delré <delre.guillaume@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RedisArray on phpredis

1 participant