# `RpcLoadBalancer.LoadBalancer.WeightedRoundRobinCache`
[🔗](https://github.com/MikaAK/rpc_load_balancer/blob/main/lib/rpc_load_balancer/load_balancer/weighted_round_robin_cache.ex#L1)

ETS-backed cache for the expanded weighted node list maintained by
`RpcLoadBalancer.LoadBalancer.SelectionAlgorithm.WeightedRoundRobin`.

The expanded list is `Enum.flat_map(node_list, &List.duplicate(&1, weight))`
— rebuilt only when the running node membership changes. Storing it
in ETS (not `:persistent_term`) means topology churn doesn't trigger
global GC sweeps; in a large cluster with continuous flapping that
would dominate.

Hot-path reads use the macro-injected `lookup/1` (direct `:ets.lookup/2`)
and writes use `insert_raw/1`, bypassing both the telemetry wrapper
and `Cache.TermEncoder`.

# `entry`

```elixir
@type entry() :: {[node()], [node()]}
```

# `adapter_options`

# `all`

Returns a list of all ETS tables at the node.

# `cache_adapter`

# `cache_name`

# `child_spec`

# `delete`

# `delete_all_objects`

Deletes all objects in the ETS table.

# `delete_expanded`

```elixir
@spec delete_expanded(atom()) :: :ok
```

# `delete_object`

Deletes the exact object from the ETS table.

# `delete_table`

Deletes the entire ETS table.

# `file2tab`

Reads a file produced by tab2file/1,2 and creates the corresponding table.

# `file2tab`

Reads a file produced by tab2file/1,2 and creates the corresponding table with options.

# `first`

Returns the first key in the table.

# `first_lookup`

Returns the first key and object(s) in the table. (OTP 26+)

# `foldl`

Folds over all objects in the table from first to last.

# `foldr`

Folds over all objects in the table from last to first.

# `from_dets`

Convert a DETS table to an ETS table.

# `get`

# `get_expanded`

```elixir
@spec get_expanded(atom()) :: entry() | nil
```

# `get_or_create`

# `give_away`

Makes process pid the new owner of the table.

# `info`

Get information about the ETS table.

# `info`

Get specific information about the ETS table.

# `init_table`

Replaces the existing objects of the table with objects created by calling the input function.

# `insert_new`

Same as insert/2 except returns false if any object with the same key already exists.

# `insert_raw`

Insert raw data into the ETS table using the underlying :ets.insert/2 function.

# `is_compiled_ms`

Checks if a term represents a valid compiled match specification.

# `last`

Returns the last key in the table (for ordered_set, otherwise same as first).

# `last_lookup`

Returns the last key and object(s) in the table. (OTP 26+)

# `lookup`

Returns a list of all objects with the given key.

# `lookup_element`

Returns the Pos:th element of the object with the given key.

# `lookup_element`

Returns the Pos:th element of the object with the given key, or default if not found. (OTP 26+)

# `match`

Continues a match started with match/2.

# `match_delete`

Deletes all objects that match the pattern from the table.

# `match_object`

Match objects in the ETS table that match the given pattern.

# `match_object`

Match objects in the ETS table that match the given pattern with limit.

# `match_pattern`

Matches the objects in the table against the pattern.

# `match_pattern`

Matches the objects in the table against the pattern with a limit.

# `match_spec_compile`

Transforms a match specification into an internal representation.

# `match_spec_run`

Executes the matching specified in a compiled match specification on a list of terms.

# `member`

Check if a key is a member of the ETS table.

# `next`

Returns the next key following the given key.

# `next_lookup`

Returns the next key and object(s) following the given key. (OTP 26+)

# `prev`

Returns the previous key preceding the given key (for ordered_set).

# `prev_lookup`

Returns the previous key and object(s) preceding the given key. (OTP 26+)

# `put`

# `put_expanded`

```elixir
@spec put_expanded(atom(), [node()], [node()]) :: :ok
```

# `rename`

Renames the table to the new name.

# `repair_continuation`

Restores an opaque continuation that has passed through external term format.

# `safe_fixtable`

Fixes the table for safe traversal.

# `select`

Select objects from the ETS table using a match specification.

# `select`

Select objects from the ETS table using a match specification with limit.

# `select_count`

Counts the objects matching the match specification.

# `select_delete`

Delete objects from the ETS table using a match specification.

# `select_replace`

Replaces objects matching the match specification with the match specification result.

# `select_reverse`

Like select/1 but returns the list in reverse order for ordered_set.

# `select_reverse`

Like select/2 but traverses in reverse order for ordered_set.

# `setopts`

Sets table options (only heir is allowed after creation).

# `slot`

Returns the list of objects associated with slot I.

# `tab2file`

Dumps the table to a file.

# `tab2file`

Dumps the table to a file with options.

# `tab2list`

Returns a list of all objects in the table.

# `tabfile_info`

Returns information about the table dumped to file.

# `table`

Returns a QLC query handle for the table.

# `table`

Returns a QLC query handle for the table with options.

# `take`

Returns and removes all objects with the given key.

# `test_ms`

Tests a match specification against a tuple.

# `to_dets`

Convert an ETS table to a DETS table.

# `update_counter`

Update a counter in the ETS table.

# `update_counter`

Update a counter in the ETS table with a default value.

# `update_element`

Updates specific elements of an object.

# `update_element`

Updates specific elements of an object with a default. (OTP 26+)

# `whereis`

Returns the tid of this named table.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
