{"id":16889757,"url":"https://github.com/benoitc/memdb","last_synced_at":"2025-04-11T13:08:03.093Z","repository":{"id":66247166,"uuid":"48333688","full_name":"benoitc/memdb","owner":"benoitc","description":"Erlang memory backend K/V store","archived":false,"fork":false,"pushed_at":"2015-12-20T22:27:15.000Z","size":64,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T10:07:22.142Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benoitc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-20T19:11:45.000Z","updated_at":"2024-03-09T05:19:21.000Z","dependencies_parsed_at":"2023-03-17T02:12:29.546Z","dependency_job_id":null,"html_url":"https://github.com/benoitc/memdb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fmemdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fmemdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fmemdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fmemdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benoitc","download_url":"https://codeload.github.com/benoitc/memdb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248404599,"owners_count":21097780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T16:58:46.227Z","updated_at":"2025-04-11T13:08:03.074Z","avatar_url":"https://github.com/benoitc.png","language":"Erlang","readme":"\n\n# memdb - provides a memory-backed K/V store #\n\nCopyright (c) 2015 Benoît Chesneau.\n\n__Version:__ 0.1.0.\n\n# memdb: simple memory database\n\nmemdb is K/V store built on top of [ETS](http://www.erlang.org/doc/man/ets.html). memdb compared to ETS provides\nconcurrent access to the database using [MVCC](https://en.wikipedia.org/wiki/Multiversion_concurrency_control) allowing\nmultiple reader to read concurrently a consitent view of the database without locking.\n\nAll writes are serialized for now.\n\nA MemDB's memory consumption increases monotonically, even if keys are deleted or values are updated. Compaction can be\ntriggered manually or automatically using the auto-vacuum. A full snapshot can be stored or copied in another database\nif needed.\n\n## Documentation\n\nFull doc is available in the [`memdb`](memdb.md) module.\n\n## Usage:\n------\n\n'''\n\n### Create a database:\n\n```\nDb = memdb:open(Name).\n```\n\n### Store a values\n\nStoring a value associated to a key using `memdb:put/3`:\n\n```\nKey = \u003c\u003c\"a\"\u003e\u003e,\nValue = 1,\nok =  memdb:put(Key, Value, Db).\n```\n\n### Retrieve a value\n\nUse the `memdb:get/2` function to retrieve a value.\n\n```\nValue = memdb:get(Key, Db).\n```\n\nValue should be 1\n\n\u003e Note: you can use `memdb:contains/2`.\n\n### Delete a value\n\nUse `memdb:delete/2` to delete a value:\n\n```\nok = memdb:clear(Ke, Dby).\n```\n\n### Store and write multiples values in one pass:\n\nUsing `memdb:write_batch/2` you can write and delete multiple values in one\npass:\n\n```\nok =  memdb:write_batch([{put, \u003c\u003c\"a\"\u003e\u003e, 1},\n                         lput, \u003c\u003c\"b\"\u003e\u003e, 2},\n                         {put, \u003c\u003c\"c\"\u003e\u003e, 3}], Db),\n\nok =  memdb:write_batch([{put, \u003c\u003c\"d\"\u003e\u003e, 4},\n                         {delete, \u003c\u003c\"b\"\u003e\u003e},\n                         {put, \u003c\u003c\"e\"\u003e\u003e, 5}], Db).\n```\n\n### Retrieve multiple values in a range:\n\nUse `memdb:fold/4` to retrieve multiples K/Vs\n\n### Close a storage\n\nClose a storage using `memdb:close/1`:\n\n```\nmemdb:close(Engine)\n```\n\n## Build\n\n```\n$ make\n```\n\n\n\n## Modules ##\n\n\n\u003ctable width=\"100%\" border=\"0\" summary=\"list of modules\"\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ca href=\"memdb.md\" class=\"module\"\u003ememdb\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fmemdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenoitc%2Fmemdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fmemdb/lists"}