{"id":18573889,"url":"https://github.com/basedwon/memorydb","last_synced_at":"2025-10-16T09:09:09.135Z","repository":{"id":197120987,"uuid":"698015703","full_name":"basedwon/memorydb","owner":"basedwon","description":"An in-memory database that's designed for high-performance data storage and retrieval.","archived":false,"fork":false,"pushed_at":"2023-09-29T02:12:45.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T17:58:22.212Z","etag":null,"topics":["database","doubly-linked-list","in-memory-database"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/basedwon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-29T00:42:52.000Z","updated_at":"2023-09-29T00:49:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"8e1130aa-c79b-4468-b907-355392f80e94","html_url":"https://github.com/basedwon/memorydb","commit_stats":null,"previous_names":["basedwon/memorydb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basedwon%2Fmemorydb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basedwon%2Fmemorydb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basedwon%2Fmemorydb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basedwon%2Fmemorydb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basedwon","download_url":"https://codeload.github.com/basedwon/memorydb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442334,"owners_count":22071863,"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":["database","doubly-linked-list","in-memory-database"],"created_at":"2024-11-06T23:13:19.140Z","updated_at":"2025-10-16T09:09:04.115Z","avatar_url":"https://github.com/basedwon.png","language":"JavaScript","readme":"# MemoryDB\n\n[![npm](https://img.shields.io/npm/v/@plaindb/memorydb?style=flat\u0026logo=npm)](https://www.npmjs.com/package/@plaindb/memorydb)\n[![pipeline](https://gitlab.com/frenware/framework/plaindb/memorydb/badges/master/pipeline.svg)](https://gitlab.com/frenware/framework/plaindb/memorydb/-/pipelines)\n[![license](https://img.shields.io/npm/l/@plaindb/memorydb)](https://gitlab.com/frenware/framework/plaindb/memorydb/-/blob/master/LICENSE)\n[![downloads](https://img.shields.io/npm/dw/@plaindb/memorydb)](https://www.npmjs.com/package/@plaindb/memorydb) \n\n[![Gitlab](https://img.shields.io/badge/Gitlab%20-%20?logo=gitlab\u0026color=%23383a40)](https://gitlab.com/frenware/framework/plaindb/memorydb)\n[![Github](https://img.shields.io/badge/Github%20-%20?logo=github\u0026color=%23383a40)](https://github.com/basedwon/memorydb)\n[![Twitter](https://img.shields.io/badge/@basdwon%20-%20?logo=twitter\u0026color=%23383a40)](https://twitter.com/basdwon)\n[![Discord](https://img.shields.io/badge/Basedwon%20-%20?logo=discord\u0026color=%23383a40)](https://discordapp.com/users/basedwon)\n\nAn in-memory database that's designed for high-performance data storage and retrieval. Support for sorted data structures and batch operations that enable sorted and efficient data handling operations. You can perform CRUD operations, iterate through sorted data, and much more.\n\n## Features\n\n- In-memory sorted data storage\n- Event Emitters\n- Built-in batch operations\n- Supports key and value encoding\n- Event-driven architecture\n- Streaming support\n\n## Installation\n\nInstall the package with:\n\n```bash\nnpm install @plaindb/memorydb\n```\n\n## Usage\n\n### Import the Package\n\n```js\nimport MemoryDB from '@plaindb/memorydb'\n```\nor\n```js\nconst MemoryDB = require('@plaindb/memorydb')\n```\n\n### Create a New MemoryDB Instance\n\n```js\nconst db = new MemoryDB()\n```\n\n### Insert a Key-Value Pair\n\n```js\nawait db.put('key', 'value')\n```\n\n### Retrieve a Value by Key\n\n```js\nconst value = await db.get('key')\n```\n\n### Delete a Key\n\n```js\nawait db.del('key')\n```\n\n### Batch Operations\n\n```js\nconst batch = db.batch()\nbatch.put('key1', 'value1')\nbatch.put('key2', 'value2')\nbatch.del('key3')\nawait batch.build()\n```\n\n### Sub Databases\n\nYou can also create sub-databases.\n\n```js\nconst subDb = db.sub('subDbPath')\n```\n\n## Example\n\n```js\nconst db = new MemoryDB()\n// put, get and del operations will wait for the instance to be ready but you can call it explicitly\nawait db.isReady()\n\n// put key-value pair\nawait db.put('key1', 'value1')\n\n// get value by key\nconsole.log(await db.get('key1'))  // Output: value1\n\n// delete key\nawait db.del('key1')\n\n// batch operations\nawait db.batch([\n  { type: 'put', key: 'key1', value: 'value1' },\n  { type: 'put', key: 'key2', value: 'value2' }\n])\n```\n\n## Documentation\n\n- [API Reference](/docs/api.md)\n\n### Class `MemoryDB`\n\n#### `async put(key, value)`\n\nInserts a new key-value pair or updates the value if the key already exists.\n\n#### `async get(key)`\n\nRetrieves the value for the given key. Returns `null` if the key does not exist.\n\n#### `async del(key)`\n\nDeletes a key and its corresponding value from the database.\n\n#### `sub(path, opts)`\n\nReturns a subtree.\n\n#### `iterator(opts)`\n\nIterates through all the key-value pairs.\n\n#### `listAll(opts)`\n\nPrints all key-value pairs.\n\n#### `batch(ops)`\n\nBatch execute multiple operations.\n\n#### `isReady()`\n\nReturns a promise that resolves when the database is ready.\n\n#### `collect(type, opts)`\n\nCollects keys or values based on the given options.\n\n## Tests\n\nIn order to run the test suite, simply clone the repository and install its dependencies:\n\n```bash\ngit clone https://gitlab.com/frenware/framework/plaindb/memorydb.git\ncd basd\nnpm install\n```\n\nTo run the tests:\n\n```bash\nnpm test\n```\n\n## Contributing\n\nThank you! Please see our [contributing guidelines](/docs/contributing.md) for details.\n\n## Donations\n\nIf you find this project useful and want to help support further development, please send us some coin. We greatly appreciate any and all contributions. Thank you!\n\n**Bitcoin (BTC):**\n```\n1JUb1yNFH6wjGekRUW6Dfgyg4J4h6wKKdF\n```\n\n**Monero (XMR):**\n```\n46uV2fMZT3EWkBrGUgszJCcbqFqEvqrB4bZBJwsbx7yA8e2WBakXzJSUK8aqT4GoqERzbg4oKT2SiPeCgjzVH6VpSQ5y7KQ\n```\n\n## License\n\n@plaindb/memorydb is [MIT licensed](https://gitlab.com/frenware/framework/plaindb/memorydb/-/blob/master/LICENSE).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasedwon%2Fmemorydb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasedwon%2Fmemorydb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasedwon%2Fmemorydb/lists"}