(dev/core#217) PrevNext - Probe for best available implementation (memory-backed or SQL-backed) #12543
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likeZRANGE
) -- e.g.CRM_Core_PrevNextCache_Redis
.This PR allows one to register parallel classes in
CRM/Utils/Cache/{mydriver}
andCRM/Core/PrevNextCache/{mydriver}
. It is a cherry-pick of some commits from #12377.This particular PR does not actually register
prevnext.driver.redis
orprevnext.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 ofCRM_Core_PrevNextCache_Sql
.After
If you define
CIVICRM_DB_CACHE_CLASS
, and if there's a corresponding serviceprevnext.driver.{mydriver}
, then it will use that service.Otherwise, it will use
prevnext.driver.sql
(CRM_Core_PrevNextCache_Sql
) -- which is the current driver.