-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
Convert some more legacy caches to standardise cache container #14487
Conversation
(Standard links)
|
Jenkins re test this please |
1 similar comment
Jenkins re test this please |
CRM/ACL/BAO/ACL.php
Outdated
@@ -688,7 +688,8 @@ public static function retrieve(&$params, &$defaults) { | |||
*/ | |||
public static function setIsActive($id, $is_active) { | |||
// note this also resets any ACL cache | |||
CRM_Core_BAO_Cache::deleteGroup('contact fields'); | |||
$cache = Civi::cache('fields'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or simply
- CRM_Core_BAO_Cache::deleteGroup('contact fields');
+ Civi::cache('fields')->flush();
CRM/ACL/Form/ACL.php
Outdated
@@ -254,7 +254,8 @@ public static function formRule($params) { | |||
*/ | |||
public function postProcess() { | |||
// note this also resets any ACL cache | |||
CRM_Core_BAO_Cache::deleteGroup('contact fields'); | |||
$cache = Civi::cache('fields'); | |||
$cache->flush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
|
||
//CRM-8559, cache navigation do not respect locale if it is changed, so reseting cache. | ||
CRM_Core_BAO_Cache::deleteGroup('navigation'); | ||
$navigationCache = Civi::cache('navigation'); | ||
$navigationCache->flush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
..same
CRM/Contact/BAO/Contact.php
Outdated
@@ -1321,9 +1321,10 @@ public static function importableFields( | |||
|
|||
$fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or
$fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields) ?: Civi::cache('fields')->get($cacheKeyString);
CRM/Core/BAO/CustomGroup.php
Outdated
@@ -259,7 +259,8 @@ public static function retrieve(&$params, &$defaults) { | |||
*/ | |||
public static function setIsActive($id, $is_active) { | |||
// reset the cache | |||
CRM_Core_BAO_Cache::deleteGroup('contact fields'); | |||
$cache = Civi::cache('fields'); | |||
$cache->flush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
6272ddf
to
0fb1630
Compare
thanks @monishdeb i have updated now to hopefully be more streamlined in the code |
0fb1630
to
b973d97
Compare
Nice, from code/style POV I am happy with the patch. Waiting for @totten @eileenmcnaughton for their feedback :) |
@@ -296,7 +296,7 @@ public function buildPrevNextCache($sort) { | |||
|
|||
if (Civi::service('prevnext') instanceof CRM_Core_PrevNextCache_Sql) { | |||
// SQL-backed prevnext cache uses an extra record for pruning the cache. | |||
CRM_Core_BAO_Cache::setItem($cacheKey, 'CiviCRM Search PrevNextCache', $cacheKey); | |||
Civi::cache('prevNextCache')->set($cacheKey, $cacheKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@totten agreed that the effect of
Civi::cache('prevNextCache')->set($cacheKey, $cacheKey);
is a clumsy way of saying
Civi::cache('prevNextCache')->set($cacheKey, TRUE);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear - I support setting the value in the same way it was set before. But Eileen had a question about whether it was meaningful to do set($cacheKey,$cacheKey)
, and (conceptually) these could be the same (although I'd make no assumption that they're actually equivalent in practice).
Also, note that CRM_Core_BAO_PrevNextCache::cleanupCache()
specifically relies on this cache being stored in SQL. I'd recommend skeptical eye about using a cache-backend that is dynamically-chosen (as in prevNextCache' => 'CiviCRM Search PrevNextCache' ... 'type' => ['*memory*', 'SqlGroup', 'ArrayCache']
in Container.php
below) when there are hard-coded bits that assume this cache is SQL-backed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@totten good point have just pushed up change to ensure prevNextCache is sql Backed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@totten should CRM_Core_BAO_PrevNextCache:::cleanupCache()
be aware of the backed provider of prev next service?
b973d97
to
93a63a5
Compare
@seamuslee001 needs a rebase |
Streamline caches calls as per Monish's comments Split prevNextCache out on its own as it needs to be SQLbacked all the time for the moment whilst clearing is hard coded
93a63a5
to
3ade468
Compare
@eileenmcnaughton rebased now |
@totten still hoping you will review this |
following a chat with @totten i have now split this PR up into separate ones for each cache group #14580 PrevNextCache I have left some notes on what reviewers should be looking at when reviewing. Hopefully split up they might be easier to review ping @monishdeb @mattwire |
closing this as it has been addressed via other PRs |
Overview
This converts some more legacy caches to Civi::cache containers
Before
The current status. Please provide screenshots or gifs (LICEcap, SilentCast) where appropriate.
After
What has been changed. Please provide screenshots or gifs (LICEcap, SilentCast) where appropriate.
ping @totten @eileenmcnaughton