@stateloom/server
v1.0.0-alpha.0
Published
Memory-bounded server scope management for StateLoom. Prevents memory leaks from per-request scopes with LRU eviction and TTL-based expiration.
Downloads
54
Readme
@stateloom/server
Memory-bounded server scope management for StateLoom. Prevents memory leaks from per-request scopes with LRU eviction and TTL-based expiration.
Install
pnpm add @stateloom/serverQuick Start
import { createServerScope } from '@stateloom/server';
const scopes = createServerScope({
maxEntries: 10_000,
ttl: 30 * 60 * 1000, // 30 minutes
onEvict: (id, scope) => scope.dispose(),
});
// Per-request handler
function handleRequest(sessionId: string) {
const scope = scopes.get(sessionId);
// Use scope for isolated state...
}Exports
| Export | Description |
| ---------------------------- | ----------------------------------------------------- |
| createServerScope(options) | Create a server scope manager with LRU + TTL eviction |
Documentation
Full documentation with API reference, lifecycle management, and framework integration: docs/api/server
License
MIT
