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.
return;
}
- // also record an entry in the cache key table, so we can delete it periodically
- CRM_Core_BAO_Cache::setItem($cacheKey, 'CiviCRM Search PrevNextCache', $cacheKey);
+ 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);
+ }
}
}
}
}
- // also record an entry in the cache key table, so we can delete it periodically
- CRM_Core_BAO_Cache::setItem($cacheKey, 'CiviCRM Search PrevNextCache', $cacheKey);
+ 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);
+ }
}
/**