Skip to content
Snippets Groups Projects

[issue 3419681] move caching to the hook_rebuild

Closed webroru requested to merge issue/csp-3419681:3419681-mysql-error-general into 2.x
3 unresolved threads

Closes #3419681

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
16 16 attach(context) {
17 17 $(context)
18 18 .find('[data-drupal-selector="edit-policies"] > details')
19 .each(function () {
19 .each(function detailsEach() {
  • 129 128 $sources[$type] = array_unique($sources[$type]);
    130 129 }
    131 130
    132 $this->cache->set($cid, $sources, Cache::PERMANENT, [
    133 'library_info',
    134 'config:core.extension',
    135 ]);
    136
    • Comment on lines -132 to -136

      Cache set shouldn't be removed from service methods - if cached data isn't available for whatever reason after a rebuild, it should still be stored for future requests on demand.

    • Please register or sign in to reply
  • 4 4 * @file
    5 5 * CSP module hooks.
    6 6 */
    7
    8 use Drupal\Core\Cache\Cache;
    9
    10 /**
    11 * Implements hook_rebuild().
    12 */
    13 function csp_rebuild() {
    14 $sources = \Drupal::service('csp.library_policy_builder')->getSources();
    15
    16 \Drupal::service('cache.default')->set('csp:sources', $sources, Cache::PERMANENT, [
    17 'library_info',
    18 'config:core.extension',
    19 ]);
  • webroru added 1 commit

    added 1 commit

    Compare with previous version

  • webroru added 1 commit

    added 1 commit

    Compare with previous version

  • webroru added 1 commit

    added 1 commit

    Compare with previous version

  • closed

  • Please register or sign in to reply
    Loading