npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wgr-sa/strapi-plugin-cloudflare-cache

v0.1.3

Published

A Strapi plugin to manage and clear Cloudflare cache for dynamic content updates.

Downloads

62

Readme

Strapi Cloudflare Cache Purge Plugin

This plugin enables automatic purging of Cloudflare cache when content in specified Strapi models is added, edited, or deleted. It uses Cloudflare's API to clear cache for your specified zone, ensuring that your visitors always see the latest content.

Installation

  1. Install the plugin: npm i @wgr-sa/strapi-plugin-cloudflare-cache

  2. Configure Environment Variables: Add the following variables to your environment configuration:

    CLOUDFLARE_API_TOKEN=<your_cloudflare_api_token>
    CLOUDFLARE_ZONE_ID=<your_cloudflare_zone_id>
    • CLOUDFLARE_API_TOKEN: Cloudflare API token with permission to manage cache.
    • CLOUDFLARE_ZONE_ID: Cloudflare Zone ID for the site.

Configuration

The plugin configuration file allows customization of the models (UIDs) that trigger cache purges.

  1. Plugin Config File: Open the plugin configuration file (typically found at ./config/plugins.js) and add the plugin configuration. This example configures the plugin with Cloudflare credentials and lists specific models (UIDs) for triggering cache purges:

    module.exports = ({ env }) => ({
      'strapi-plugin-cloudflare-cache': {
        enabled: true,
        config: {
          uids: ['api::article.article', 'api::category.category'], // Add the UIDs for models you want to purge cache on change
        },
      },
    });
  2. Config Options:

    • uids: Array of Strapi model UIDs that will trigger cache purges on create, update, and delete actions.
  3. Validation: The plugin checks that cloudflareToken and cloudflareZoneId are provided. If these are missing, the plugin will throw an error on startup.

Usage

  1. When enabled and configured, the plugin will automatically purge Cloudflare cache for the specified zone whenever content in the listed models is created, updated, or deleted in Strapi.

  2. Example Usage:

    • If you specify uids: ['api::article.article'], any changes to articles in Strapi will trigger a Cloudflare cache purge, ensuring that new or modified articles are immediately reflected on your site.

Troubleshooting

  • Missing API Token or Zone ID: If cloudflareToken or cloudflareZoneId are not set, the plugin will not start. Ensure both are defined in your environment configuration.
  • Cache Not Purging: Check that the API token has permissions to manage cache for the specified zone and that the zone ID is correct.

License

This plugin is licensed under the MIT License.