Scruby
A fast key-value storage library.
Scruby is a fast key-value storage library that provides an ordered mapping from string keys to string values. The library uses fractal-tree addressing.
The maximum size of the database is 16**32=340282366920938463463374607431768211456 branches, each branch can store one or more keys.
The value of any key can be obtained in 32 steps, thereby achieving high performance. There is no need to iterate through all the keys in search of the desired value.
Installation¶
uv add scruby
Usage¶
import anyio
from scruby import Scruby
async def main() -> None:
"""Example."""
db = Scruby()
await db.set_key("key name", "Some text")
await db.get_key("key name") # => "Some text"
await db.get_key("key missing") # => KeyError
await db.has_key("key name") # => True
await db.has_key("key missing") # => False
await db.delete_key("key name")
await db.delete_key("key missing") # => KeyError
# Full database deletion.
await db.napalm()
await db.napalm() # => FileNotFoundError
if __name__ == "__main__":
anyio.run(main)
Requirements¶
View the list of requirements.
Changelog¶
License¶
This project is licensed under the MIT.