Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What does ->multi() return? #2432

Open
raph90 opened this issue Jan 10, 2024 · 1 comment
Open

What does ->multi() return? #2432

raph90 opened this issue Jan 10, 2024 · 1 comment

Comments

@raph90
Copy link

raph90 commented Jan 10, 2024

There is an inconsistency between the docs site and the 'one readme to rule them all'.

The docs site says of multi:
"Return value: True if the transaction could be started."

While the readme says:
"Return value: multi() returns the Redis instance and enters multi-mode. Once in multi-mode, all subsequent method calls return the same object until exec() is called."

This has led to errors in our code base of commands being called on booleans. So it would be awesome to have clarity on how this works. Thank you!

EDIT:
Looking at the code here: https://github.com/phpredis/phpredis/blob/develop/redis_cluster.c#L1864-L1892
I think it's the case that we get back false if we're already in multi mode, otherwise we get our RedisCluster object. I hope that's correct - happy to close this if so.

@michael-grunder
Copy link
Member

Yep you're reading that correctly. If you are already in multi mode PhpRedis can return false here. I'll see about updating the docs though if we don't say that.

michael-grunder added a commit that referenced this issue Mar 28, 2024
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

No branches or pull requests

2 participants