PHPackages                             wieni/wmpage\_cache - 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. wieni/wmpage\_cache

ActiveDrupal-module[Caching](/categories/caching)

wieni/wmpage\_cache
===================

Caches pages for anonymous users, with more customisability than the default page cache module

1.0.0(2y ago)02.6k↓80%2[2 issues](https://github.com/wieni/wmpage_cache/issues)[3 PRs](https://github.com/wieni/wmpage_cache/pulls)2MITPHPPHP &gt;=7.1

Since Aug 30Pushed 2y ago2 watchersCompare

[ Source](https://github.com/wieni/wmpage_cache)[ Packagist](https://packagist.org/packages/wieni/wmpage_cache)[ RSS](/packages/wieni-wmpage-cache/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (5)Versions (9)Used By (2)

Page Cache
==========

[](#page-cache)

[![Latest Stable Version](https://camo.githubusercontent.com/de05f1814d81faa028219bf90cea2e3a263edb148fb35e6f3a1e7261d39cfed4/68747470733a2f2f706f7365722e707567782e6f72672f7769656e692f776d706167655f63616368652f762f737461626c65)](https://packagist.org/packages/wieni/wmpage_cache)[![Total Downloads](https://camo.githubusercontent.com/94b0a09c630343636dbc0b7888bd2d2b0a445878c18f980a39f5dcdccde9692a/68747470733a2f2f706f7365722e707567782e6f72672f7769656e692f776d706167655f63616368652f646f776e6c6f616473)](https://packagist.org/packages/wieni/wmpage_cache)[![License](https://camo.githubusercontent.com/b0100dcf3dd9b623deaa9f3476f4aca2d487a5174610f3f7546f2a97b608fa50/68747470733a2f2f706f7365722e707567782e6f72672f7769656e692f776d706167655f63616368652f6c6963656e7365)](https://packagist.org/packages/wieni/wmpage_cache)

> Caches pages for anonymous users, with more customisability than the default page cache module.

Why?
----

[](#why)

- Provides more configurable options than the default page cache module
- Allows you to choose between multiple cache storages (database, [Redis](https://github.com/wieni/wmpage_cache_redis), [Flysystem](https://github.com/wieni/wmpage_cache_flysystem)) and cache invalidators/purgers (default, [Cloudfront](https://github.com/wieni/wmpage_cache_cloudfront))

Installation
------------

[](#installation)

This package requires PHP 7.1 and Drupal 8 or higher. It can be installed using Composer:

```
 composer require wieni/wmpage_cache
```

To prevent unnecessary early rendering issues when creating custom controllers, a patch from the following issue should be included:

[\#2638686: Exception in EarlyRenderingControllerWrapperSubscriber is a DX nightmare, remove it](https://www.drupal.org/project/drupal/issues/2638686)

How does it work?
-----------------

[](#how-does-it-work)

### Configuring the module

[](#configuring-the-module)

Settings can be changed through container parameters. Check [`wmpage_cache.services.yml`](wmpage_cache.services.yml) for a list of settings, what they do and their default values.

### About cacheability metadata

[](#about-cacheability-metadata)

Just like the [Internal Page Cache](https://www.drupal.org/docs/administering-a-drupal-site/internal-page-cache) &amp; [Dynamic Page Cache](https://www.drupal.org/docs/8/core/modules/dynamic-page-cache/overview) core modules, this module uses cacheability metadata (cache tags, cache contexts and max-age) to determine the cacheability of a request and to make sure cached pages are invalidated when necessary.

### Adding cacheable metadata from a controller

[](#adding-cacheable-metadata-from-a-controller)

There are a bunch of different things you can return in a controller and cacheable metadata can be included in pretty much every one of them.

#### Render arrays

[](#render-arrays)

Cacheability metadata can be included in a render array under the `#cache` key. For more information, please refer to the [official documentation](https://www.drupal.org/docs/8/api/render-api/cacheability-of-render-arrays).

#### Response objects

[](#response-objects)

Cacheable `Response` objects have to implement `CacheableResponseInterface` and can use the `CacheableResponseTrait`. For more information, please refer to the [official documentation](https://www.drupal.org/docs/8/api/responses/cacheableresponseinterface).

#### wmcontroller `ViewBuilder`

[](#wmcontroller-viewbuilder)

When rendering a Twig template, eg. by using the wmcontroller `ViewBuilder`, all cacheable metadata of parameters that are passed to the template are automatically included.

### Adding cacheable metadata from a Twig extension

[](#adding-cacheable-metadata-from-a-twig-extension)

If a Twig extension is returning information that will be used in a Twig template, without going through the Drupal render system, any cacheability metadata will be lost. That's why it's better to dispatch cacheability metadata in the logic of the Twig extension. You can do this by attaching the metadata to an empty render array and rendering it:

```
$build = [];
(new CacheableMetadata())
    ->addCacheableDependency($entity)
    ->applyTo($build);

$this->renderer->render($build);
```

In case this Twig extension is called often, this can impact performance. Another option is to collect all metadata until the end of page rendering, and attach it once in a `hook_page_attachments` implementation.

Changelog
---------

[](#changelog)

All notable changes to this project will be documented in the [CHANGELOG](CHANGELOG.md) file.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

Distributed under the MIT License. See the [LICENSE](LICENSE) file for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~139 days

Total

5

Last Release

908d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/734199ae17f8da336fef9ba81f7c37cda09b0f9a952f551235c32ecfad68488b?d=identicon)[Wieni](/maintainers/Wieni)

---

Top Contributors

[![DieterHolvoet](https://avatars.githubusercontent.com/u/3606531?v=4)](https://github.com/DieterHolvoet "DieterHolvoet (78 commits)")[![RobinHoutevelts](https://avatars.githubusercontent.com/u/9056689?v=4)](https://github.com/RobinHoutevelts "RobinHoutevelts (74 commits)")[![frizinak](https://avatars.githubusercontent.com/u/823696?v=4)](https://github.com/frizinak "frizinak (61 commits)")[![akasake](https://avatars.githubusercontent.com/u/32063989?v=4)](https://github.com/akasake "akasake (5 commits)")[![jelteliekens](https://avatars.githubusercontent.com/u/3418474?v=4)](https://github.com/jelteliekens "jelteliekens (1 commits)")

---

Tags

cachingdrupal-8drupal-9drupal-module

### Embed Badge

![Health badge](/badges/wieni-wmpage-cache/health.svg)

```
[![Health](https://phpackages.com/badges/wieni-wmpage-cache/health.svg)](https://phpackages.com/packages/wieni-wmpage-cache)
```

###  Alternatives

[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M421](/packages/drupal-core-recommended)

PHPackages © 2026

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