Gamora.Cache.Introspect (gamora v0.15.0)

View Source

This module that allows to get, set and fetch introspection data in the cache in order to improve performance.

Summary

Functions

Deletes introspect cache for the given access token.

Returns introspect data for the given access token if exists, otherwise it will fetch it and store it.

Returns introspect data for the given access token.

Stores introspect data for the given access token.

Functions

del(access_token)

@spec del(access_token :: String.t()) :: {:ok, map()}

Deletes introspect cache for the given access token.

Parameters

  • access_token: String [Access token from IDP].

Examples

iex> del("ACCESS_TOKEN")
{:ok, true}

fetch(access_token)

@spec fetch(access_token :: String.t()) :: {:ok, map()} | {:error, term()}

Returns introspect data for the given access token if exists, otherwise it will fetch it and store it.

Parameters

  • access_token: String [Access token from IDP].

Examples

iex> fetch("ACCESS_TOKEN")
{:ok, %{"active" => true, ...}}

get(access_token)

@spec get(access_token :: String.t()) :: {:ok, nil} | {:ok, map()}

Returns introspect data for the given access token.

Parameters

  • access_token: String [Access token from IDP].

Examples

iex> get("ACCESS_TOKEN")
{:ok, nil}

iex> get("ACCESS_TOKEN")
{:ok, %{"active" => true, ...}}

put(access_token, data)

@spec put(access_token :: String.t(), data :: map()) :: {:ok, map()}

Stores introspect data for the given access token.

Parameters

  • access_token: String [Access token from IDP].

Examples

iex> put("ACCESS_TOKEN", %{"active" => true, ...})
{:ok, %{"active" => true, ...}}