Skip to content

Conversation

shakaran
Copy link
Contributor

@shakaran shakaran commented Jul 16, 2025

Fixes #608

@ostrolucky
Copy link
Collaborator

What about Predis?

@shakaran shakaran changed the title feat: implement option redis OPT_SCAN for phpredis. Issue #608 feat: implement option redis OPT_SCAN for phpredis and predis . Issue #608 Jul 17, 2025
@shakaran
Copy link
Contributor Author

What about Predis?

The original issue #608 was only mentioning phpredis. I just add predis support too. Let me know if it is ok. Thanks

$dsnOptions = array_merge($defaultOptions, $options, $dsnOptions);

if (isset($options['scan']) && $options['scan'] === 'prefix') {
$dsnOptions[Redis::OPT_SCAN] = Redis::SCAN_PREFIX;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overwritten by next instruction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, moved after parseDsn() so the options get merged. Resolved at 95f7e4e

$dsnOptions = array_merge($defaultOptions, $options, $dsnOptions);

if (isset($options['scan']) && $options['scan'] === 'prefix') {
$dsnOptions[Redis::OPT_SCAN] = Redis::SCAN_PREFIX;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class shouldn't use \Redis class, as that belongs to phpredis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved at 95f7e4e using class constants

@ostrolucky ostrolucky force-pushed the master branch 3 times, most recently from 37c8fe3 to e049151 Compare July 18, 2025 10:25
@ostrolucky ostrolucky force-pushed the feature/allow-opt-scan branch 7 times, most recently from e8cae42 to bda25c6 Compare July 18, 2025 11:00
@ostrolucky ostrolucky changed the title feat: implement option redis OPT_SCAN for phpredis and predis . Issue #608 feat: implement option redis OPT_SCAN for phpredis Jul 18, 2025
@ostrolucky ostrolucky changed the title feat: implement option redis OPT_SCAN for phpredis feat: phpredis: add support for OPT_SCAN Jul 18, 2025
@ostrolucky
Copy link
Collaborator

Sorry, in the end found this option is not relevant for predis so I've removed it. What was mistaking me was that there was never added support for prefix in this bundle for predis. In master I've added support for prefix in Predis. I've rebased this PR and did bunch of changes, most of it was a cleanup but one thing that's functional is that config option is now numeric, this way people can directly reference values of the phpredis constants.

@ostrolucky ostrolucky force-pushed the feature/allow-opt-scan branch 3 times, most recently from 457aea4 to d2ba59a Compare July 18, 2025 11:06
@ostrolucky ostrolucky force-pushed the feature/allow-opt-scan branch from d2ba59a to dedf291 Compare July 18, 2025 11:08
@ostrolucky ostrolucky merged commit 7f01860 into snc:master Jul 18, 2025
6 checks passed
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.

Allow setting the OPT_SCAN option for phpredis
2 participants