feat(plugin-state): add registerIfAbsent keyed store (#77135)

This commit is contained in:
Alex Knight
2026-05-04 18:20:04 +10:00
committed by GitHub
parent 071db2ca69
commit fcb396bf65
8 changed files with 283 additions and 34 deletions

View File

@@ -417,12 +417,13 @@ Provider and channel execution paths must use the active runtime config snapshot
});
await store.register("key-1", { value: "hello" });
const claimed = await store.registerIfAbsent("dedupe-key", { value: "first" });
const value = await store.lookup("key-1");
await store.consume("key-1");
await store.clear();
```
Keyed stores survive restarts and are isolated by the runtime-bound plugin id. Limits: `maxEntries` per namespace, 1,000 live rows per plugin, JSON values under 64KB, and optional TTL expiry.
Keyed stores survive restarts and are isolated by the runtime-bound plugin id. Use `registerIfAbsent(...)` for atomic dedupe claims: it returns `true` when the key was missing or expired and registered, or `false` when a live value already exists without overwriting its value, creation time, or TTL. Limits: `maxEntries` per namespace, 1,000 live rows per plugin, JSON values under 64KB, and optional TTL expiry.
<Warning>
Bundled plugins only in this release.