The Process Dictionary
Each process in Erlang has its own private data store called the process dictionary. The process dictionary is an associative array (in other languages this might be called a map, hashmap, or hash table) composed of a collection of keys and values. Each key has only one value.
The dictionary can be manipulated using the following BIFs:
put(Key, Value) -> OldValue.-
Add a
Key,Valueassociation to the process dictionary. The value ofputisOldValue, which is the previous value associated withKey. If there was no previous value, the atomundefinedis returned. get(Key) -> Value.-
Look up the value of
Key. If there is aKey,Valueassociation in the dictionary, returnValue; otherwise, return the atomundefined. get() -> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access