ETS tables
| Bag | |
| Set | |
| Ordered set | |
| Select and delete |
Bag
A bag ETS table allows duplicate keys. Each insert adds another copy, and select returns all copies matching a key. It is the simplest of the three table types.
1> Tab = ets:new(bag, [named_table, bag]).
#Ref
ets:insert(Tab, {key, value1}).
ok
ets:insert(Tab, {key, value2}).
ok
ets:select(Tab, key).
[{key, value1}, {key, value2}]
Next: Timers and timeouts
Article author: Arthur Isaev