View Source OpenApiSpex.Plug.Cache behaviour (open_api_spex v3.21.2)

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

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

Functions

@spec adapter() :: module()

Get cache adapter

@spec refresh() :: :ok

Only erase cache, put again when plug starting