Mity Docs Mity Docs for Mity Digital
Scheduled Cache Invalidator Documentation

Scheduled Cache Invalidator

The Scheduled Cache Invalidator for Statamic is a simple command to add to your site's Console Kernel to run every minute to help keep your cache fresh for time-based content.

It is available open source for you to use in your Statamic projects.

What is it?

Let's say you have a Blog, and your Statamic site uses full (or half) Static Caching.

Now, imagine you have written a blog post that you want to go live at midday tomorrow.

What would you prefer to do:

  • wait around until midday tomorrow to publish (or manually flush the cache), or

  • publish now, and have this utility take care of flushing the cache for you?

This command is designed to be run every minute, and looks for Entries (in all of your dated Collections) that are scheduled to be published at that minute.

For each Collection that is found, the static cache for that Collection is invalidated using Statamic's configuration: this means that your invalidation rules will be honoured.

Features

Simply add this command to your scheduled jobs, and when an Entry is due to be published, will clear the Collection's cache.

  • set and run, with no configuration

  • honours your static cache invalidation rules from Statamic

  • hooks in with Laravel's Task Scheduling