{"id":27048455,"url":"https://github.com/SirJosh3917/StringDB","last_synced_at":"2025-04-05T07:01:49.573Z","repository":{"id":143436559,"uuid":"135196522","full_name":"monoclex/StringDB","owner":"monoclex","description":"StringDB is a modular, key/value pair archival DB designed to consume *tiny* amounts of ram \u0026 produce *tiny* databases.","archived":false,"fork":false,"pushed_at":"2023-02-24T16:28:40.000Z","size":2337,"stargazers_count":72,"open_issues_count":4,"forks_count":12,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-09T09:13:38.445Z","etag":null,"topics":["database","easy-to-use","lightweight","small","stringdb"],"latest_commit_sha":null,"homepage":"","language":"C#","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/monoclex.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,"governance":null}},"created_at":"2018-05-28T18:35:04.000Z","updated_at":"2025-01-22T09:58:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa4916b9-37e0-4544-a409-e981cf8262f5","html_url":"https://github.com/monoclex/StringDB","commit_stats":null,"previous_names":["sirjosh3917/stringdb"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monoclex%2FStringDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monoclex%2FStringDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monoclex%2FStringDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monoclex%2FStringDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monoclex","download_url":"https://codeload.github.com/monoclex/StringDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299829,"owners_count":20916190,"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","easy-to-use","lightweight","small","stringdb"],"created_at":"2025-04-05T07:01:25.650Z","updated_at":"2025-04-05T07:01:49.463Z","avatar_url":"https://github.com/monoclex.png","language":"C#","readme":"# StringDB\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://rawcdn.githack.com/SirJosh3917/StringDB/master/icons/banner_ad.png\" alt=\"StringDB\" /\u003e\n\n[![Build Status][badge_appveyor_build_image]][badge_appveyor_build_page]\n[![Test Status][badge_tests_image]][link_codecov]\n[![Nuget Version][badge_nuget_version_image]][link_nuget]\n[![Nuget Downloads][badge_nuget_downloads_image]][link_nuget]\n\n\u003c/div\u003e\n\n[```Install-Package StringDB```][link_nuget]\n\n## Introduction\n\nStringDB is a key/value pair store with a friendly API to use as little RAM and space as possible.\n\nVerify the claims for yourself:\n\n- [Api][section_api]\n- [Tiny][section_tiny]\n\n## Api\n\nEnumerate over a database and it's values, the fastest, by enumerating over it optimally\n```cs\nusing var db = new DatabaseBuilder()\n\t.UseIODatabase(StringDBVersion.Latest, \"database.db\", out var optimalTokenSource)\n\t.WithBuffer(1000)\n\t.WithTranform(StringTransformation.Default, StringTransformation.Default);\n\t\nforeach (var (key, value) in db.EnumerateOptimally(optimalTokenSource))\n{\n\t// do something with the key and value\n}\n```\n\nUse fluent extensions to create a database:\n\n```cs\nusing IDatabase\u003cstring, string\u003e db = new DatabaseBuilder()\n    .UseIODatabase(StringDBVersion.Latest, \"database.db\")\n    .WithBuffer(1000)\n    .WithTransform(StringTransformation.Default, StringTransformation.Default);\n\nusing IDatabase\u003cint, string\u003e memDb = new DatabaseBuilder()\n    .UseMemoryDatabase\u003cint, string\u003e();\n```\n\nUse the IDatabase interface to interface with databases\n\n```cs\nvoid InsertGreeting(IDatabase\u003cstring, string\u003e database, string user)\n{\n    database.Insert(user, $\"Greetings, {user}!\");\n}\n```\n\nAnd inherit BaseDatabase to create your own IDatabases with minimal effort\n\n```cs\npublic class TestDatabase : BaseDatabase\u003cint, string\u003e\n{\n    private class LazyValue : ILazyLoader\u003cstring\u003e\n    {\n        private readonly string _value;\n        public LazyValue(int value) =\u003e _value = value.ToString();\n        public string Load() =\u003e _value;\n        public void Dispose() {}\n    }\n\t\n\tpublic override void Dispose() {}\n\n    protected override void InsertRange(KeyValuePair\u003cint, string\u003e[] items)\n    {\n        foreach(var item in items)\n        {\n            Console.WriteLine($\"{item.Key}: {item.Value}\");\n        }\n    }\n\n    protected override IEnumerable\u003cKeyValuePair\u003cint, ILazyLoader\u003cstring\u003e\u003e\u003e Evaluate()\n    {\n        for(var i = 0; i \u003c int.MaxValue)\n        {\n            yield return KeyValuePair.Create(i, new LazyValue(i));\n        }\n    }\n}\n```\n\n## Tiny ![icon_tiny]\n\nStringDB is *tiny*. Use *tiny* amounts of RAM, and *tiny* amounts of space.\n\n### [StringDB 10.0.0 file size: single inserts, 128 byte keys, 1024 byte values][source_insert_test]\n\n![Chart][icon_chart_single_inserts]\n\n| Inserts | Size (in KB, 1000 bytes) | Absolute Minimum Size Possible | StringDB Overhead Percentage |\n| --- | --- | --- | --- |\n| 1 | 1.172 KB | 1.152 KB | 1.706485% |\n| 50 | 58.208 KB | 57.6 KB | 1.04453% |\n| 100 | 116.408 KB | 115.2 KB | 1.037729% |\n\nThis chart shows the size of a StringDB file after multiple *single inserts*. Every key is 128 bytes long, and every value is 1024 bytes long. By doing single inserts, file size is dramatically affected due to the additional overhead for the index chain.\n\n### [StringDB 10.0.0 file size: insert range, 128 byte keys, 1024 byte values][source_insertrange_test]\n\n![Chart][icon_chart_insert_range]\n\n| Elements in Insert Range | Size (in KB, 1000 bytes) | Absolute Minimum Size Possible | StringDB Overhead Percentage |\n| --- | --- | --- | --- |\n| 1 | 1.172 KB | 1.152 KB | 1.706485% |\n| 50 | 57.963 KB | 57.6 KB | 0.626262% |\n| 100 | 115.913 KB | 115.2 KB | 0.615117% |\n\nThis chart shows the size of a StringDB file after a single insert range with the amount of items specified.\n\n## Addons\n\nOfficial addon support will be maintained for [these libraries.][link_addons]\n\n## Issues welcomed!\n\nDon't be afraid to make an issue about anything and everything!\n\n- Is there something weird with how databases are created? Submit an issue!\n- Is there something that you wish you could do but can't? Submit an issue!\n- Is this library not suitable for your purposes? Submit an isssue!\n- Want it to do something? Submit an issue!\n\nIt's an honour to have you use this library, and feedback is needed to make this the greatest it can be.\n\nNeed immediate assistence? [Join the discord!](discord)\n\n[icon_banner_ad]: ./icons/banner_ad.png\n[icon_tiny]: ./icons/tiny.png\n[icon_chart_single_inserts]: ./icons/single_inserts.svg\n[icon_chart_insert_range]: ./icons/insert_range.svg\n\n[badge_appveyor_build_image]: https://img.shields.io/appveyor/ci/SirJosh3917/StringDB/master.svg?style=flat-square\n[badge_tests_image]: https://img.shields.io/codecov/c/github/SirJosh3917/StringDB/master.svg?style=flat-square\n[badge_nuget_version_image]: https://img.shields.io/nuget/v/StringDB.svg?style=flat-square\n[badge_nuget_downloads_image]: https://img.shields.io/nuget/dt/StringDB.svg?style=flat-square\n\n[badge_appveyor_build_page]: https://ci.appveyor.com/project/sirjosh3917/stringdb\n\n[link_nuget]: https://www.nuget.org/packages/StringDB\n[link_addons]: ./addons/addons.md\n[link_codecov]: https://codecov.io/gh/SirJosh3917/StringDB\n\n[section_tiny]: #tiny-\n[section_api]: #api\n\n[source_insert_test]: ./src/StringDB.PerformanceNumbers/SingleInsertFileSize.cs\n[source_insertrange_test]: ./src/StringDB.PerformanceNumbers/InsertRangeFileSize.cs\n\n[discord]: https://discord.gg/wVcnkKJ\n","funding_links":[],"categories":["框架, 库和工具","Frameworks, Libraries and Tools","Database","数据库"],"sub_categories":["数据库","Database"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSirJosh3917%2FStringDB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSirJosh3917%2FStringDB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSirJosh3917%2FStringDB/lists"}