PHPackages                             aerni/dynamic-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. aerni/dynamic-cache

AbandonedArchivedLibrary[Caching](/categories/caching)

aerni/dynamic-cache
===================

Supercharge Statamic's static cache by dynamically excluding URLs that shouldn't be cached statically

v1.1.2(3y ago)3954[2 issues](https://github.com/aerni/statamic-dynamic-cache/issues)MITPHPPHP ^7.4|^8.0

Since Feb 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/aerni/statamic-dynamic-cache)[ Packagist](https://packagist.org/packages/aerni/dynamic-cache)[ Docs](https://github.com/aerni/statamic-dynamic-cache)[ RSS](/packages/aerni-dynamic-cache/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (5)Dependencies (7)Versions (6)Used By (0)

---

### This addon has been archived in favor of the long-awaited [nocache tag](https://statamic.dev/tags/nocache), which was introduced in [Statamic v3.3.20](https://github.com/statamic/cms/releases/tag/v3.3.20).

[](#this-addon-has-been-archived-in-favor-of-the-long-awaited-nocache-tag-which-was-introduced-in-statamic-v3320)

---

[![Statamic](https://camo.githubusercontent.com/93d33dcdd370c8e4e34b4186825dc0e37e2796db65c5e344dc5d106b09af12a9/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f53746174616d69632f332e302b2f464632363945)](https://camo.githubusercontent.com/93d33dcdd370c8e4e34b4186825dc0e37e2796db65c5e344dc5d106b09af12a9/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f53746174616d69632f332e302b2f464632363945) [![Packagist version](https://camo.githubusercontent.com/726da1161880586b81450033d089570b7153636afc54e26c7401c9a7bc0ff034/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f6165726e692f64796e616d69632d63616368652f6c6174657374)](https://camo.githubusercontent.com/726da1161880586b81450033d089570b7153636afc54e26c7401c9a7bc0ff034/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f6165726e692f64796e616d69632d63616368652f6c6174657374) [![Packagist Total Downloads](https://camo.githubusercontent.com/9049514495127aaa0116796b28cf9d4450f3981518dccc986add07f3a9e8a641/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f6165726e692f64796e616d69632d6361636865)](https://camo.githubusercontent.com/9049514495127aaa0116796b28cf9d4450f3981518dccc986add07f3a9e8a641/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f6165726e692f64796e616d69632d6361636865) [![License](https://camo.githubusercontent.com/aa70b1b018fa9ee0a96c0c1c4a8ac189ac28e126d0596b2d70b78c44a8493614/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f6c6963656e73652f6165726e692f73746174616d69632d64796e616d69632d6361636865)](https://camo.githubusercontent.com/aa70b1b018fa9ee0a96c0c1c4a8ac189ac28e126d0596b2d70b78c44a8493614/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f6c6963656e73652f6165726e692f73746174616d69632d64796e616d69632d6361636865)

Dynamic Cache
=============

[](#dynamic-cache)

If you ever used Statamic's static caching with the `full` strategy, you know that it doesn't play well with forms and dynamic listings like `sort="random"`. This is where Dynamic Cache steps in. It dynamically updates the `exclude` and invalidation `rules` array in your `static_caching.php` config based on a boolean in your entries' content.

Dynamic Cache is a lifesaver for sites with complex page builders based on Replicator and Bard. Your page builder might have dozens of components and only one requiring dynamic functionality. Without this addon, you'd have to do without full static caching because you'd never know which page actually included that one component that doesn't work when cached statically.

Features
--------

[](#features)

- Adds your entries' URLs to the static caching `exclude` array
- Populates the invalidation `rules` array
- Updates the config whenever you save or delete an entry or change the structure of a collection
- Artisan Command to manually trigger a config update

> **Note:** This addon currently only works with collection entries.

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

[](#installation)

Install the addon using Composer:

```
composer require aerni/dynamic-cache
```

Publish the config of the package:

```
php please vendor:publish --tag=dynamic-cache-config
```

The following config will be published to `config/dynamic-cache.php`.

```
return [

    /*
    |--------------------------------------------------------------------------
    | Field Handle
    |--------------------------------------------------------------------------
    |
    | Define the name of the field handle you would like to use.
    | Default: 'exclude_from_static_cache'
    |
    */

    'handle' => 'exclude_from_static_cache',

];
```

Configuration
-------------

[](#configuration)

You may change the field's handle that is used to check if an entry should be excluded from the static cache. The handle defaults to `exclude_from_static_cache`.

Basic Usage
-----------

[](#basic-usage)

Dynamic Cache will look for `exclude_from_static_cache: true` in your entries. The best way to add this value to your content is by creating a Fieldset with a Hidden Fieldtype and adding it to your Blueprints where necessary.

If you use a page builder, I suggest adding the Fieldset to every Replicator or Bard set that requires dynamic functionality. This way, the entry will only be excluded from the static cache if the component in question is present. If it is not, the entry will be cached statically.

**Fieldset with Hidden Fieldtype:**

```
title: 'Exclude From Static Cache'
fields:
  -
    handle: exclude_from_static_cache
    field:
      display: 'Exclude From Static Cache'
      type: hidden
      icon: hidden
      listable: hidden
      replicator_preview: false
      default: true
```

Alternatively, you can also use a Toggle Fieldtype to manually turn the static cache on and off. Just note that this kind of defeats the dynamic problem this addon is trying to solve …

**Fieldset with Toggle Fieldtype:**

```
title: 'Exclude From Static Cache'
fields:
  -
    handle: exclude_from_static_cache
    field:
      display: 'Exclude From Static Cache'
      type: toggle
      icon: toggle
      listable: hidden
```

Manual Config Changes
---------------------

[](#manual-config-changes)

You are free to manually change the `exclude` and `rules` array in the `static_caching.php` config. Dynamic Cache is smart enough to merge your manual changes.

Invalidation Rules
------------------

[](#invalidation-rules)

This addon will not generate any invalidation rules if the config is set to `rules => 'all'`.

Commands
--------

[](#commands)

You may update the config with the following command:

```
php artisan dynamic-cache:update
```

This is useful if you change your entries in your code editor rather than in the Control Panel.

Git Automation
--------------

[](#git-automation)

This addon supports Statamic's Git integration. Simply add the following paths to the `paths` array in your `git.php` config. Also, make sure that the addon's storage path is tracked by git.

```
'paths' => [
    config_path('statamic'),
    storage_path('statamic/addons/dynamic-cache'),
]
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

5

Last Release

1427d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f0a168dc347e5e141dc13cec734d3b0a25a13445069483732580f26f71456a6?d=identicon)[aerni](/maintainers/aerni)

---

Top Contributors

[![aerni](https://avatars.githubusercontent.com/u/23167701?v=4)](https://github.com/aerni "aerni (41 commits)")

---

Tags

statamicstatamic-3statamic-addonstatamic-v3statamicstatic-cache

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/aerni-dynamic-cache/health.svg)

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

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[statamic/statamic

Statamic

824170.4k](/packages/statamic-statamic)[silverstripe/staticpublishqueue

Static publishing queue to create static versions of pages for enhanced performance and security

45135.4k4](/packages/silverstripe-staticpublishqueue)[statamic-rad-pack/meilisearch

meilisearch search driver for Statamic

1661.7k](/packages/statamic-rad-pack-meilisearch)[aryehraber/statamic-captcha

Protect your Statamic forms using a Captcha service

16194.4k](/packages/aryehraber-statamic-captcha)[visuellverstehen/statamic-classify

A useful helper to add CSS classes to all HTML tags generated by the bard editor.

20116.8k](/packages/visuellverstehen-statamic-classify)

PHPackages © 2026

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