View Source Sanity.Cache (sanity_cache v0.4.0)

Link to this section Summary

Functions

Defines a Sanity query.

Fetches a single document by making a request to the Sanity CMS API. The cache is not used.

Fetches list of key/value pairs.

Gets a single document using cache. If the cache table doesn't exist then fetch/2 will be called. Returns {:ok, value} or {:error, :not_found}.

Like get/3 except raises if not found.

Updates a cache table.

Link to this section Functions

Link to this macro

defq(name, opts)

View Source (macro)

Defines a Sanity query.

options

Options

  • :config_key - The default value is :default.

  • :projection - Required.

  • :list_query - Required.

  • :lookup - Required.

Fetches a single document by making a request to the Sanity CMS API. The cache is not used.

options

Options

  • :config_key - The default value is :default.

  • :projection - Required.

  • :fetch_query - Required.

Fetches list of key/value pairs.

options

Options

  • :config_key - The default value is :default.

  • :projection - Required.

  • :list_query - Required.

  • :keys - Required.

Gets a single document using cache. If the cache table doesn't exist then fetch/2 will be called. Returns {:ok, value} or {:error, :not_found}.

Like get/3 except raises if not found.

Updates a cache table.

options

Options

  • :fetch_pairs_mfa - Required.

  • :table - Required.

  • :update_remote_nodes - The default value is false.