In-memory
memory:// keeps every object in the process’s RAM. Nothing touches disk
and everything disappears when the process exits.
import namidb
db = namidb.Client("memory://demo") # or "memory://?ns=demo"db.cypher("CREATE (:Person {name: 'Alice'})")namidb-server --store memory://demo --auth-token "$NAMIDB_AUTH_TOKEN"namidb run "RETURN 1 AS x" # the CLI uses memory:// when --store is omittedBehaviour
- Each URI parse creates a new store. Two
Client("memory://demo")objects in the same process do not share data; each starts empty. Share a singleClient(it is thread-safe) when several parts of a program need the same in-memory graph. - The full engine runs on top: WAL, manifest commits, flush, compaction,
indexes and constraints all behave as on a durable backend, which makes
memory://a faithful test fixture. - Only
ns/namespaceis accepted as a query parameter; anything else is an error, so a typo cannot silently open a different namespace. - Memory use grows with the data and is not bounded by the cache settings. Keep it to small graphs.
When to use it
Use memory:// for | Use something else for |
|---|---|
| Unit and integration tests | Anything you want to keep |
| Notebook experiments and demos | Graphs larger than comfortable RAM |
One-shot CLI checks (namidb run, namidb explain) | Sharing a graph between processes |
For a durable graph on one machine, switch to
file://; nothing else in your
code changes.