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

(dev/core#217) CRM_Utils_Cache_Redis::connect() - Allow pooling connections #12544

Merged
merged 1 commit into from
Jul 24, 2018

Conversation

totten
Copy link
Member

@totten totten commented Jul 24, 2018

Overview

In a world with CRM/Utils/Cache/Redis.php and the (upcoming) CRM/Core/PrevNextCache/Redis.php, there would be two classes which need access to the same Redis connection. This allows each one to request a connection -- but only one connection will really be made.

This is a cherry-pick of some commits from #12377.

See also: dev/core#217

Before

  • Every time you create an instance of CRM_Utils_Cache_Redis, it makes a new instance of the driver class Redis.

After

  • Every time you create an instance of CRM_Utils_Cache_Redis, it uses a shared instance of the driver class Redis (assuming the host/port are the same).
  • If you're writing a driver somewhere else (e.g. the upcoming CRM_Core_PrevNextCache_Redis), you can use the shared instance of Redis.

…ctions

Before
------

* Every time you create an instance of `CRM_Utils_Cache_Redis`, it makes
  a new instance of the driver class `Redis`.

After
-----

* Every time you create an instance of `CRM_Utils_Cache_Redis`, it uses
  a shared instance of the driver class `Redis` (assuming the host/port
  are the same).
* If you're writing a driver somewhere else (e.g. the upcomgin
  `CRM_Core_PrevNextCache_Redis`), you can use the shared instance
  of `Redis`.
@civibot
Copy link

civibot bot commented Jul 24, 2018

(Standard links)

@eileenmcnaughton
Copy link
Contributor

I tested this locally & stepped through & Redis still loads fine with this change. I tested without a password but reading the code the change on with-password is pretty cosmetic - merge on pass

@eileenmcnaughton eileenmcnaughton merged commit d5ab908 into civicrm:master Jul 24, 2018
@totten totten deleted the master-redis-pool branch July 24, 2018 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants