Commit e37c68e1 authored by totten's avatar totten

(#635) Only write extra prevnext cache record if used

This line of code creates an extra record to facilitate clearing the
SQL-based prevnext cache.  However, with Redis-based prevnext cache, it's
not needed because the Redis implementation simply uses a TTL -- and (on
Redis deployments) this lines to gratuitous SQL writes.
parent 45b25a1b
......@@ -294,10 +294,12 @@ FROM {$from}
return;
}
// also record an entry in the cache key table, so we can delete it periodically
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);
}
}
}
/**
* @return array
......
......@@ -1062,9 +1062,11 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
}
}
// also record an entry in the cache key table, so we can delete it periodically
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);
}
}
/**
* called to rebuild prev next cache using full sql in case of core search ( excluding custom search)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment