buildTags example

return $this->hash('is-super-user');
    }

    $sorted_roles = $account->getRoles();
    sort($sorted_roles);
    $role_list = implode(',', $sorted_roles);
    $cid = "user_permissions_hash:$role_list";
    if ($static_cache = $this->static->get($cid)) {
      return $static_cache->data;
    }
    else {
      $tags = Cache::buildTags('config:user.role', $sorted_roles, '.');
      if ($cache = $this->cache->get($cid)) {
        $permissions_hash = $cache->data;
      }
      else {
        $permissions_hash = $this->doGenerate($sorted_roles);
        $this->cache->set($cid$permissions_hash, Cache::PERMANENT, $tags);
      }
      $this->static->set($cid$permissions_hash, Cache::PERMANENT, $tags);
    }

    return $permissions_hash;
  }

    }
    $result = $this->findNoLongerExistingLinks($definitions);

    // Remove all such items.     if ($result) {
      $this->purgeMultiple($result);
    }
    $this->resetDefinitions();
    $affected_menus = $this->getMenuNames() + $before_menus;
    // Invalidate any cache tagged with any menu name.     $cache_tags = Cache::buildTags('config:system.menu', $affected_menus, '.');
    $this->cacheTagsInvalidator->invalidateTags($cache_tags);
    $this->resetDefinitions();
    // Every item in the cache bin should have one of the menu cache tags but it     // is not guaranteed, so invalidate everything in the bin.     $this->menuCacheBackend->invalidateAll();
  }

  /** * Purges multiple menu links that no longer exist. * * @param array $ids * An array of menu link IDs. */
// Test the $glue parameter.       ['config:system.menu', ['menu_name']['config:system.menu.menu_name'], '.'],
    ];
  }

  /** * @covers ::buildTags * * @dataProvider buildTagsProvider */
  public function testBuildTags($prefix, array $suffixes, array $expected$glue = ':') {
    $this->assertEquals($expected, Cache::buildTags($prefix$suffixes$glue));
  }

  /** * @covers ::keyFromQuery * @group legacy */
  public function testKeyFromQuery() {
    $this->expectDeprecation('Drupal\Core\Cache\Cache::keyFromQuery is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. No replacement provided. https://www.drupal.org/node/3322044');
    $query = new Select(new StubConnection(new StubPDO()[]), 'dne');
    Cache::keyFromQuery($query);
  }

}
Home | Imprint | This part of the site doesn't use cookies.