Image.Plug.VariantStore.ETS (image_plug v0.1.0)

Copy Markdown View Source

In-memory ETS-backed implementation of Image.Plug.VariantStore.

A singleton owner process holds a :protected ETS table. Reads go straight to ETS; writes go through the owner process to serialise inserts and to populate the :inserted_at / :updated_at timestamps.

Configuration

Started by the :image_plug application with a default table name of :image_plug_variants. Variants are seeded from the application environment:

# config/config.exs
config :image_plug,
  variants: [
    {"thumbnail", "width=200,height=200,fit=cover,format=webp"},
    {"hero",      "width=1600,format=auto,quality=82"}
  ]

Each entry value can be:

The implicit "public" variant is always seeded and represents Cloudflare's default "no transforms" behaviour. It can be overridden by adding an explicit "public" entry to the seeds.

Per-call options

Every callback accepts a :table keyword to address a non-default table — useful for tests and for hosts that run multiple isolated stores.