Optional ETS cache for scope data (roles + permissions).
Disabled by default. Enable with:
config :permit_ex,
cache: true,
cache_ttl: :timer.minutes(5)Mutation APIs invalidate cache automatically. Call invalidate/2 or
invalidate_all/0 after external changes (raw SQL, another node, etc.).
Summary
Functions
Returns true when caching is enabled via config.
Fetches cached scope data for a user/context pair.
Invalidates cached scope data.
Drops the entire scope cache.
Stores scope data for a user/context pair when caching is enabled.
Functions
Returns true when caching is enabled via config.
Fetches cached scope data for a user/context pair.
Returns {:ok, {roles, permissions}} or :miss.
Invalidates cached scope data.
invalidate(user_id, context_id)— one scope (usenilfor global)invalidate(user_id, :all)— every context for that user
Drops the entire scope cache.
Stores scope data for a user/context pair when caching is enabled.