Skip to content

This repository is a maintained REPLICA of its main repository on drupal.org. Intended for displaying README.md and easy code browsing, apart from this, please don't create pull requests and use drupal.org's infrastructure.

nielsvm/purge_queuer_url

Repository files navigation

This module queues URLs or paths to your Purge queue.

Drupal 8 introduces tag-based cache invalidation which is much more efficient than legacy URL or path based invalidation and leads to less processing and smaller queues. However, when your CDN or external caching system does not support tag-based invalidation, this module is for you!

How it works

The module trains its traffic registry by collecting URLs from requests that miss cache inside Drupal's own page cache. These URLs are stored along with their associated cache tags inside this same traffic registry. Now when Drupal invalidates a set of tags because someone edited a page, these tags are used to fetch URLs from the registry and are added to the Purge queue.

Accuracy

Those that remember cache expiration for Drupal 7 are familiar with the side effects of some changes not being automatically detected. This module can guarantee very high accuracy since it simply leverages D8's highly innovative tags based caching architecture, which is thoroughly covered by tests that cover edge cases most site builders wouldn't think off. Examples of things that just work are pagers (/news/?page=10), RSS or Json views (/rss.xml) and any view or view block, like that one dynamic block placed on /contact that shows corporate press releases.

Very important warning!

This module isn't suited for everyone and can bring your site down if you're not careful!

Because it stores URLs for all of your traffic, sites with thousands of content items can end up creating a unsustainable large registry with database strain as ultimate consequence. If you're noticing that queries coming from this module are severely slowing down your website, the only alternatives you have are:

  1. Switch to a CDN that does support tag-based cache invalidation.
  2. Stay with the CDN, but:
  • Uninstall and stop using purge_queuer_url.
  • Configure the CDN to override your caching policy at the edge.
  • The override should set a reasonably short cache policy for all CDN-to-browser delivery.

Getting started

  • Setup the Purge module.
  • Make sure that your purger(s) support URL or path invalidations.
  • drush en purge_queuer_url --yes
  • drush cset system.performance cache.page.max_age 31536000 (year)
  • drush cache-rebuild to empty Drupal's page cache.

To achieve accurate URL based cache invalidation, it is best to take a head start by training the traffic registry that purge_queuer_url maintains:

wget -r -nd --delete-after -l100 --spider http://mydrupalsite/

When this process finished, editing any item on your site should result in several URLs being added to the Purge queue (see drush p-queue-browse). Ordinary website traffic will automatically add new URLs to your traffic registry and won't require any further maintenance.

About

This repository is a maintained REPLICA of its main repository on drupal.org. Intended for displaying README.md and easy code browsing, apart from this, please don't create pull requests and use drupal.org's infrastructure.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages