reki/ets

Types

A unique atom used as an ETS table name

pub type TableIdentifier(key, value)

A reference to an ETS table (the tid returned by ets:new/2)

pub type Tid

Values

pub fn delete(
  table_id: TableIdentifier(key, value),
  key: key,
) -> Result(Nil, Nil)

Delete a key-value pair from the table.

pub fn insert(
  table_id: TableIdentifier(key, value),
  key: key,
  value: value,
) -> Result(Nil, Nil)

Insert a key-value pair into the table.

pub fn lookup(
  table_id: TableIdentifier(key, value),
  key: key,
) -> option.Option(value)

Look up a value by key in the table.

pub fn new(table_id: TableIdentifier(key, value)) -> Tid

Creates a new named ETS table. Crashes if the name is already taken. The table is owned by the calling process and will be destroyed when it dies.

pub fn new_table_identifier() -> TableIdentifier(key, value)

Creates a unique atom for use as an ETS table name. WARNING: Atoms are never garbage collected by the BEAM. Only call this a fixed number of times (e.g. once per registry at app startup).

Search Document