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

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

Link to this section Summary

Functions

Get cache adapter

Only erase cache, put again when plug starting

Link to this section Callbacks

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

Link to this section Functions

@spec adapter() :: module()

Get cache adapter

@spec refresh() :: :ok

Only erase cache, put again when plug starting