-module(myets). %%-export([start/0]). -compile(export_all). %%ets:new(Name, Options) -> tid() | atom() %%默认是set类型 start()-> ets:new(test,[named_table]), ets:insert(test,{a,1}), List = ets:tab2list(test), io:format("~13w => ~p~n",[set,List]). %%============================================================== %% ets 与 record 结合 -record(user,{id,name="Lee",age=25}). start_ex()-> ets:new(test_ex,[set,named_table,{keypos,#user.id}]), First_record = #user{id=1}, ets:insert(test_ex,First_record), Second_record = #user{id=2,name="Jack"}, ets:insert(test_ex,Second_record), Index = Second_record#user.id, ets:lookup(test_ex,Index).
相关的文章介绍:
Record介绍