Skip to content

(P)redis persistent / pooled connections #689

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

Closed
marcos-guerrero opened this issue Jun 10, 2019 · 9 comments
Closed

(P)redis persistent / pooled connections #689

marcos-guerrero opened this issue Jun 10, 2019 · 9 comments

Comments

@marcos-guerrero
Copy link

Hello!

It would be great if phpfastcache allows us to use connection pooling feature available on (P)redis

persistent [boolean - default: false] :Specifies if the underlying connection resource should be left open when a script ends its lifecycle.

Description: Connects to a Redis instance or reuse a connection already established with pconnect/popen.

Thank you for taking it into consideration
Kind regards

@Geolim4
Copy link
Member

Geolim4 commented Jun 10, 2019

Hello,

I'll implement it in the 7.1 release (around end of summer), meanwhile you can pass a custom Predis/Redis instance to Phpfastcache as specified in the Uncyclo:

https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Configuration-Options#redispredis-specific-options

Cheers,
Georges

@marcos-guerrero
Copy link
Author

Ok, it's great to know it will be implemented!
I prefer to wait your release rather than switch to predis and use custom client:
We are using redis, and in this case phpfastcache has to call pconnect() or the redis client (no matter if is custom or internal) won't use persistent connections. Or am I missing something?

Thanks for your help and quick response,
Marcos

@Geolim4
Copy link
Member

Geolim4 commented Jun 10, 2019

Redis driver also support custom client ;)

@marcos-guerrero
Copy link
Author

marcos-guerrero commented Jun 10, 2019

But redis client won't use persistent connection if phpfastcache doesn't call pconnect() instead the "normal" connect(), so that's why I'll wait for your new release.

@Geolim4
Copy link
Member

Geolim4 commented Jun 10, 2019

Not sure you got the principle of "custom client" 😅
A custom client is an already-instantiated object that you provide to phpfastcache, so PFC does not need to call pconnect :)

@marcos-guerrero
Copy link
Author

With predis client I understand that the custom client will work with persistent connections, as it's a matter of configuration, I'll create the custom client passing it the persistent parameter with 1 value and voila! the client will reuse / persist the connection. I've got it!
but... with the redis client it's not a matter of configuration, it a matter of calling pconnect() method instead connect() method... so, how is it possible to make PFC aware of it? PFC is going to call connect() ... or should I pass to PFC the custom client already "pconnected"?
Thank you for help me to fully understand the custom client concept!

@Geolim4
Copy link
Member

Geolim4 commented Jun 10, 2019 via email

@marcos-guerrero
Copy link
Author

Sorry! You're right, my fault for not re-read the manual.
Thank you very much for your time and help!

@Geolim4
Copy link
Member

Geolim4 commented Jun 14, 2019

Planned for 7.1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants