I am writing a cache gen-server for the company Use. I am wondering how to search an item from the list as I want the cost of the search for comparing various data structure
Use keyfind
function from lists
module. For example:
30> List = [{"A1",["ankit","sush", "Hover", "x4", "a3","nilesh","mike","erlang"]}].
[{"A1",
["ankit","sush","Hover","x4","a3","nilesh","mike",
"erlang"]}]
31> lists:keyfind("A1", 1, List).
{"A1",
["ankit","sush","Hover","x4","a3","nilesh","mike","erlang"]}