FileSessionStore constructor
FileSessionStore(})
Creates a file-backed store rooted at dirPath (created if missing).
maxPersistedChainLength: when set, snapshots older than this many entries in a chain are automatically deleted on each save.snapshotPathPrefix: returns a sub-directory prefix derived from the call'scontext(e.g. the authenticated user id), useful for multi-tenant isolation: all reads and writes are scoped to that prefix, so one tenant can never see another's snapshots. Defaults to"global".rejectBranchingSessions: whentrue, asessionIdlookup that resolves to a branched history (more than one leaf) throws StatusCodes.FAILED_PRECONDITION instead of returning the latest leaf. Defaults tofalse; opt in (e.g. in dev) to surface accidental branching early.snapshotWatchPollInterval: polling interval for the onSnapshotStateChange fallback that backstops the directory watcher (which can miss events on some filesystems, e.g. network mounts).
Implementation
FileSessionStore(
String dirPath, {
this.maxPersistedChainLength,
this.snapshotPathPrefix,
this.rejectBranchingSessions = false,
Duration snapshotWatchPollInterval = _defaultSnapshotWatchPollInterval,
}) : _dir = Directory(dirPath).absolute,
_snapshotWatchPollInterval = snapshotWatchPollInterval {
_dir.createSync(recursive: true);
}