RIG.DistributedSet (Reactive Interaction Gateway v3.0.0-alpha.2) View Source

Distributed grow-only set with per key time-to-live support.

Link to this section Summary

Functions

Add a new record to this set.

Returns a specification to start this module under a supervisor.

Handles adding a record, broadcasted from another node.

Check whether this set includes a key or not.

Creates a new distributed set.

Link to this section Types

Specs

creation_ts() :: non_neg_integer()

Specs

expiration_ts() :: non_neg_integer()

Specs

key() :: String.t()

Specs

record() :: {key(), uuid(), creation_ts(), expiration_ts()}

Specs

uuid() :: String.t()

Link to this section Functions

Link to this function

add(server, key, ttl_s \\ 86400)

View Source

Specs

add(pid() | atom(), key(), non_neg_integer()) :: :ok

Add a new record to this set.

Re-adding already included keys may be used to extend a key's lifetime.

Returns a specification to start this module under a supervisor.

See Supervisor.

Handles adding a record, broadcasted from another node.

Link to this function

has?(name, key, opts \\ [])

View Source

Specs

has?(pid() | atom(), key(), list()) :: boolean()

Check whether this set includes a key or not.

Returns true if, and only if, the key has been added previously and it has not yet expired.

Link to this function

start_link(set_name, opts \\ [])

View Source

Creates a new distributed set.

Parameters

  • set_name: The name of the distributed set. Multiple instances with the same name will synchronize their records with each other.