Skip to main content

Multi Cache

The multi_cache plugin allows an attacher to accept files from additional temporary storages.

Shrine.storages = { cache: ..., cache_one: ..., cache_two: ..., store: ... }

Shrine.plugin :multi_cache, additional_cache: [:cache_one, :cache_two]
photo.image = { "id" => "...", "storage" => "cache", "metadata" => { ... } }
photo.image.storage_key #=> :cache
# or
photo.image = { "id" => "...", "storage" => "cache_one", "metadata" => { ... } }
photo.image.storage_key #=> :cache_one
# or
photo.image = { "id" => "...", "storage" => "cache_two", "metadata" => { ... } }
photo.image.storage_key #=> :cache_two