Auctoritas v0.1.2 Auctoritas.AuthenticationManager.DataStorage behaviour View Source
Default DataStorage implementation (based on Cachex)
Link to this section Summary
Functions
Check for collisions
Delete token and its data
Get tokens data
Get a list of tokens
Get tokens with associated data (value and expiration)
Insert data into storage
Check if token exists
Get token expiration (countdown)
Start cachex with custom name
Link to this section Types
Link to this type
name()
View Source
name()
View Source
name() :: String.t()
name() :: String.t()
Link to this type
token()
View Source
token()
View Source
token() :: String.t()
token() :: String.t()
Link to this section Functions
Link to this function
check_collision(token) View Source
Link to this function
check_collision(name, token) View Source
Check for collisions
Arguments:
- Name: Name from config
- Token: Generated token
Link to this function
delete_token(token) View Source
Link to this function
delete_token(name, token) View Source
Delete token and its data
Arguments:
- Name: Name from config
- Token: Token to delete
Link to this function
get_token_data(token) View Source
Link to this function
get_token_data(name, token) View Source
Get tokens data
Arguments:
- Name: Name from config
- Token: Generated token
Link to this function
get_tokens(start, amount)
View Source
get_tokens(start, amount)
View Source
get_tokens(non_neg_integer(), non_neg_integer()) :: {atom(), any()}
get_tokens(non_neg_integer(), non_neg_integer()) :: {atom(), any()}
Link to this function
get_tokens(name, start, amount)
View Source
get_tokens(name, start, amount)
View Source
get_tokens(name(), non_neg_integer(), non_neg_integer()) :: {atom(), any()}
get_tokens(name(), non_neg_integer(), non_neg_integer()) :: {atom(), any()}
Get a list of tokens
Arguments:
- Name: Name from config
- Start: Starting point in the list
- Amount: Amount of tokens to take from list
Link to this function
get_tokens_with_data(start, amount)
View Source
get_tokens_with_data(start, amount)
View Source
get_tokens_with_data(non_neg_integer(), non_neg_integer()) :: {atom(), any()}
get_tokens_with_data(non_neg_integer(), non_neg_integer()) :: {atom(), any()}
Link to this function
get_tokens_with_data(name, start, amount)
View Source
get_tokens_with_data(name, start, amount)
View Source
get_tokens_with_data(name(), non_neg_integer(), non_neg_integer()) ::
{atom(), any()}
get_tokens_with_data(name(), non_neg_integer(), non_neg_integer()) :: {atom(), any()}
Get tokens with associated data (value and expiration)
Arguments:
- Name: Name from config
- Start: Starting point in the list
- Amount: Amount of tokens to take from list
Link to this function
insert_data(token, data) View Source
Link to this function
insert_data(name, token, data) View Source
Insert data into storage
Arguments:
- Name: Name from config
- Token: Generated token
- Data: Any kind of data you would like to associate with token
Link to this function
token_exists?(token) View Source
Link to this function
token_exists?(name, token) View Source
Check if token exists
Arguments:
- Name: Name from config
- Token: Generated token
Link to this function
token_expires?(token) View Source
Link to this function
token_expires?(name, token) View Source
Get token expiration (countdown)
Arguments:
- Name: Name from config
- Token: Generated token
Link to this function
worker(config) View Source
Start cachex with custom name
Link to this section Callbacks
Link to this callback
delete_token(name, token) View Source
Link to this callback
get_token_data(name, token) View Source
Link to this callback
get_tokens(name, non_neg_integer, non_neg_integer)
View Source
get_tokens(name, non_neg_integer, non_neg_integer)
View Source
get_tokens(name(), non_neg_integer(), non_neg_integer()) :: {atom(), any()}
get_tokens(name(), non_neg_integer(), non_neg_integer()) :: {atom(), any()}
Link to this callback
get_tokens_with_data(name, non_neg_integer, non_neg_integer)
View Source
get_tokens_with_data(name, non_neg_integer, non_neg_integer)
View Source
get_tokens_with_data(name(), non_neg_integer(), non_neg_integer()) ::
{atom(), any()}
get_tokens_with_data(name(), non_neg_integer(), non_neg_integer()) :: {atom(), any()}
Link to this callback
insert_data(name, token, any) View Source
Link to this callback
token_exists?(name, token) View Source
Link to this callback