PHPackages                             iqual/authenticated\_cache\_warmer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. iqual/authenticated\_cache\_warmer

AbandonedArchivedDrupal-custom-module[Caching](/categories/caching)

iqual/authenticated\_cache\_warmer
==================================

A module to warm cache for endpoints that need authentication.

1.1.1(1y ago)03.6kPHPPHP ^8.1

Since Apr 22Pushed 1y ago2 watchersCompare

[ Source](https://github.com/iqual-ch/authenticated_cache_warmer)[ Packagist](https://packagist.org/packages/iqual/authenticated_cache_warmer)[ RSS](/packages/iqual-authenticated-cache-warmer/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

Authenticated cache warmer
==========================

[](#authenticated-cache-warmer)

This module allows to warm cache on routes that need authentication. It achieves this by impersonating a user in an EventSubscriber using the `account_switcher` service and a state key to authenticate the warming requests (see Security).

Usage
-----

[](#usage)

The module only provides the API to create your own cache warmer service. You need to implement your own drush command or cron job to actually run the cache warming.

To use the API, you need the following data:

- The route you want to call (e.g. `entity.node.canonical`)
- The entity ids to request
- The user ids to impersonate
- (Optional) Http options for the GuzzleHttpClient

You then create one or more CacheWarmUrl and provide them to the `authenticated_cache_warmer.cache_warmer` service. The service will call all the provided urls with the corresponding user account, limited to 10 parallel calls.

### Example

[](#example)

The following snippet will warm both nodes 1 and 2 simulating users 2 and 3.

```
use Drupal\authenticated_cache_warmer\CacheWarmerUrl;

// Set up data.
$route = 'entity.node.canonical';
$entity_ids = [1, 2];
$user_ids = [2, 3];

// Set up urls.
$urls = [];
foreach($user_ids as $user_id) {
  foreach($entity_ids as $entity_id) {
    $urls[] = CacheWarmerUrl::create($route, ['node' => $entity_id], $user_id);
  }
}

// Run cache warming (use proper DI for service).
$cacheWarmer = \Drupal::service('authenticated_cache_warmer.cache_warmer');
$cacheWarmer->seturls($urls);
$cacheWarmer->warm();
```

Tips on CacheWarmerUrl
----------------------

[](#tips-on-cachewarmerurl)

- CacheWarmerUrl extends Drupal/Core/Url, so you can use all the `from*` methods. You then need to set the user account using `setAccountId()`.
- You can pass options to the GuzzleHttpClient used to do the call using `setHttpOptions()` or via the fourth argument on the create method. See `GuzzleHttp\ClientInterface::requestAsync` for details.

Security
--------

[](#security)

The requests are secured by generating and storing a random key on starting the warming, which is then passed along as a cookie value with the request. The EventSubscriber checks if the key is in Drupal's state and is active.

This means the calling client needs to run with the same Drupal environment/db.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance40

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~60 days

Total

5

Last Release

508d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90cd0a373720aba510d144cf310f4b036ae8d79f1f7385d663ae20b87a3fb017?d=identicon)[pvbergen](/maintainers/pvbergen)

![](https://www.gravatar.com/avatar/43082de1b2e2b2b2d48b7ff7dbc7c60ff1d0a015123d4062ac0b49ea0b3b725f?d=identicon)[iqual](/maintainers/iqual)

---

Top Contributors

[![youpixxl](https://avatars.githubusercontent.com/u/3398689?v=4)](https://github.com/youpixxl "youpixxl (9 commits)")

### Embed Badge

![Health badge](/badges/iqual-authenticated-cache-warmer/health.svg)

```
[![Health](https://phpackages.com/badges/iqual-authenticated-cache-warmer/health.svg)](https://phpackages.com/packages/iqual-authenticated-cache-warmer)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
