OpenApiSpex.Plug.Cache behaviour (open_api_spex v3.21.3)

View Source

Cache for OpenApiSpex API specs.

Settings:

config :open_api_spex, :cache_adapter, Module

There are three cache implementations:

If you are constantly modifying specs during development, you can configure the cache adapter in dev.exs as follows to disable caching:

config :open_api_spex, :cache_adapter, OpenApiSpex.Plug.NoneCache

Summary

Functions

Get cache adapter

Only erase cache, put again when plug starting

Callbacks

erase(module)

@callback erase(module()) :: :ok

get(module)

@callback get(module()) :: {OpenApiSpex.OpenApi.t(), map()} | nil

put(module, {})

@callback put(
  module(),
  {OpenApiSpex.OpenApi.t(), map()}
) :: :ok

Functions

adapter()

@spec adapter() :: module()

Get cache adapter

refresh()

@spec refresh() :: :ok

Only erase cache, put again when plug starting