MemeDB
MemeDB is a minimal in-memory key-value database that doesn't take itself too seriously. It's designed to be simple, lightweight, and fun to use.
Installation
Install MemeDB from PyPI:
pip install memedb
Quick Start
Create a new MemeDB instance and add some data:
from memedb import MemeDB
db = MemeDB()
db.set("key1", "value1")
db.set("key2", {"nested_key": "nested_value"})
Retrieve data by key:
value = db.get("key1")
print(value) # output: "value1"
nested_value = db.get("key2")["nested_key"]
print(nested_value) # output: "nested_value"
Delete data by key:
db.delete("key1")
Use transactions for atomicity:
with db.transaction():
db.set("key1", "new_value")
db.delete("key2")
Advanced Features
MemeDB also includes some more advanced features to make it more powerful:
Indexing
You can create an index for a specific key to speed up lookups:
db.index("name")
db.set("person:1", {"name": "Alice", "age": 30})
db.set("person:2", {"name": "Bob", "age": 25})
db.set("person:3", {"name": "Charlie", "age": 35})
result = db.lookup("name", "Alice")
print(result) # output: [{"name": "Alice", "age": 30}]
Querying
You can perform queries on the data using a simple SQL-like syntax:
db.set("person:1", {"name": "Alice", "age": 30})
db.set("person:2", {"name": "Bob", "age": 25})
db.set("person:3", {"name": "Charlie", "age": 35})
result = db.query("SELECT * FROM data WHERE age > 30")
print(result) # output: [{"name": "Charlie", "age": 35}]
Caching
You can add a cache to MemeDB to speed up access to frequently accessed data:
from memedb import Cache
cache = Cache(max_size=1000, ttl=3600) # cache up to 1000 items for 1 hour
db = MemeDB(cache=cache)
db.set("key1", "value1")
db.get("key1") # retrieves from cache
Contributions
Contributions are welcome! If you have a feature request or bug report, please open an issue on GitHub. If you'd like to contribute code, please fork the repository and submit a pull request.
Metadata
Release files for memedb 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| memedb-0.1.0.tar.gz | 2.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| memedb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.0 kB
Release files / memedb-0.1.0.tar.gz
| Download URL | memedb-0.1.0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4e11274609238609b19f070172eee10d16e754e8d94098fe71966d105cc6026
|
|
BLAKE2b-256 checksum How to use checksums |
4918e5b651f9884148fcfade71df1bb3e5f01a3be52ef138e837e84bd79757a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.10.7 Linux/5.19.0-35-generic
|
Release files / memedb-0.1.0-py3-none-any.whl
| Download URL | memedb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3cc207dc0dc79dc476007163d38f1ddf64bdd9321d0377b57a5fcb3294ddb30b
|
|
BLAKE2b-256 checksum How to use checksums |
44c9d662b764b31c7654b7d573afdb8adfeb83ec7561615f504218f560188eab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.10.7 Linux/5.19.0-35-generic
|
Security for memedb 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.