Skip to main content

Module intern

Module intern 

Source
Expand description

Process-wide sharing of immutable data that every connection to the same server receives identically (registry names, tags, recipes, the command tree). Many clients in one process then hold one copy instead of one each. Values are matched by content when they are stored (once per join, under a lock); reads go through the Arc / Bytes taken then and never touch the pool. An entry lives as long as something holds it.

Functions§

bytes
data as Bytes backed by the process’s shared copy of these bytes.
shared
The process’s shared copy of value (an equal value stored earlier and still alive), or value itself, which later equal values then share. Costs a hash of value and a lock: meant for data stored once per connection, not per packet.