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, Value association to the process dictionary. The value of put is OldValue, which is the previous value associated with Key. If there was no previous value, the atom undefined is returned.

get(Key) -> Value.

Look up the value of Key. If there is a Key, Value association in the dictionary, return Value; otherwise, return the atom undefined.

get() -> ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.