You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is my little 'write and read data from erlang' sheet :
{ok, Tree} = hanoidb:open("mydb.hanoidb").
ok = hanoidb:put(Tree, <<"key1">>, <<"val1">>).
ok = hanoidb:put(Tree, <<"key2">>, <<"val2">>).
{ok,<<"val1">>} = hanoidb:get(Tree, <<"key1">>).
{ok,<<"val2">>} = hanoidb:get(Tree, <<"key2">>).
ok = hanoidb:close(Tree).
After put/get, here is delete (before close obviously) :
ok = hanoidb:delete(Tree, <<"BOO">>),
not_found = hanoidb:get(Tree, <<"BOO">>)
There si also key expiry:
ok = hanoidb:put(Tree, <<"foo">>, <<"bar">>, 2), % 2 sec
{ok, <<"bar">>} = hanoidb:get(Tree, <<"foo">>),
ok = timer:sleep(3000), % 3000 ms
not_found = hanoidb:get(Tree, <<"foo">>)
And the powerfull fold(DB, Fun, Acc)
see also fold_range in the source.
Hi. I can't find api docs. Are there any?
How should I write and read data from erlang? Maybe there is some simple usage example?
The text was updated successfully, but these errors were encountered: