Storehouse.Purge.Cloudflare (Storehouse v0.2.0)

Copy Markdown View Source

A purger (Storehouse.Purge) for Cloudflare's cache: a zone's purge_cache, with an API token that may purge it.

config :storehouse, Storehouse.Purge,
  purger:
    {Storehouse.Purge.Cloudflare,
     zone_id: System.fetch_env!("CLOUDFLARE_ZONE_ID"),
     api_token: System.fetch_env!("CLOUDFLARE_API_TOKEN"),
     by: [:urls, :tags]},
  base_url: "https://example.com"

URLs go thirty a request, tags and prefixes a hundred and thirty, as Cloudflare takes them.

Options

  • :zone_id and :api_token (required).
  • :by - what to purge by: :urls (every plan), :tags and :prefixes (where the plan purges by them). The default is [:urls].
  • :endpoint - Cloudflare's API. The default is "https://api.cloudflare.com/client/v4".
  • :timeout - for each request, in milliseconds. The default is 15 seconds.