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) PrevNext - Probe for best available implementation (memory-backed or SQL-backed) #12543

Merged
merged 2 commits into from
Jul 24, 2018

Conversation

totten
Copy link
Member

@totten totten commented Jul 24, 2018

Overview

You may recall that (eg) CRM_Utils_Cache_Redis provides a PSR-16 adapter for storing caches in Redis. That structure is good as a general-purpose cache; however, for PrevNext, we need to support additional methods which are amenable to pagination. This requires a different adapter (written with direct access to Redis functiosn like ZRANGE) -- e.g. CRM_Core_PrevNextCache_Redis.

This PR allows one to register parallel classes in CRM/Utils/Cache/{mydriver} and CRM/Core/PrevNextCache/{mydriver}. It is a cherry-pick of some commits from #12377.

This particular PR does not actually register prevnext.driver.redis or prevnext.driver.memcache or similar, so it has no major functional impact on its own. That will come when we add those classes/services later.

See also: dev/core#217

Before

The prevnext service is always an instance of CRM_Core_PrevNextCache_Sql.

After

If you define CIVICRM_DB_CACHE_CLASS, and if there's a corresponding service prevnext.driver.{mydriver}, then it will use that service.

Otherwise, it will use prevnext.driver.sql (CRM_Core_PrevNextCache_Sql) -- which is the current driver.

totten added 2 commits July 23, 2018 18:19
…mory-backed or SQL-backed)

Before
------

The `prevnext` service is always an instance of `CRM_Core_PrevNextCache_Sql`.

After
-----

If you define `CIVICRM_DB_CACHE_CLASS`, and if there's a corresponding
service `prevnext.driver.{mydriver}`, then it will use that service.

Otherwise, it will use `prevnext.driver.sql` (`CRM_Core_PrevNextCache_Sql`).
@civibot
Copy link

civibot bot commented Jul 24, 2018

(Standard links)

@eileenmcnaughton
Copy link
Contributor

Makes sense. No change for now

@eileenmcnaughton eileenmcnaughton merged commit 1682822 into civicrm:master Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants