rong_storage
Storage APIs
Storage
Persistent key-value storage.
Open
const store = new Storage("./data.db");
const strict = new Storage("./strict.db", {
maxKeySize: 128,
maxValueSize: 1024 * 1024,
});
Operations
// Write (values are JSON-serialized)
await store.set("user", { name: "Alice", age: 30 });
// Read
const user = await store.get("user");
// { name: "Alice", age: 30 }
// Delete
await store.delete("user");
// Clear all
await store.clear();
List Keys
// List all keys
for (const key of await store.list()) {
console.log(key);
}
// Filter by prefix
for (const key of await store.list("user:")) {
console.log(key);
}
Info
const info = await store.info();
Notes
- The standard Rong runtime exposes a global
Storageconstructor. Rong.StorageandRong.storage.open(...)are not part of the default runtime API.- Embedders may choose to inject a preconfigured global
storageinstance, but that is host-specific.