Cache storage and freshness policy for originals and processed images.
ImagePipe.config(
source_cache_policy: [storage: :origin, freshness: {:fallback, 300}],
sources: [...]
):source_cache_policy in ImagePipe.config/1 sets the policy for every
source. A source's own :cache_policy replaces it field by field. All
durations are in seconds. See
source cache settings and
caching and freshness.
An immutable source has no
freshness deadline, even when it inherits a finite :freshness, but still
needs :storage to allow storing. Its own :cache_policy can't set a
:freshness duration or a :stale_while_revalidate window.
Options
:storage(:origin,:allow, or:deny) - Whether originals and processed images may be stored.:origin, the default, stores unless the origin sendsno-storeorprivate.:allowstores despite them, and:denynever stores.Vary: *from the origin prevents storage in every mode.:freshness(:origin,{:fallback, seconds}, or{:force, seconds}) - How long a stored copy stays fresh.:origin, the default, uses the origin's lifetime and revalidates on every request when there is none.{:fallback, seconds}applies only when the origin sends no lifetime.{:force, seconds}replaces the origin's lifetime, includingno-cache. Neither makes a response storable that:storagedoesn't allow.:stale_while_revalidate(:origin,:disabled, or{:force, seconds}) - How long an expired copy may still be served while it is refreshed.:origin, the default, uses the origin'sstale-while-revalidate, which an originno-cache,must-revalidate,proxy-revalidate, ors-maxageturns off.:disabledserves no expired copies.{:force, seconds}sets the window, whatever the origin sends.
Summary
Functions
Merges validated policies field by field, with source settings taking precedence.
Types
@type t() :: keyword()