Type Method
ephemeral(cacheDirectory:)
Returns a fully self-cleaning ephemeral configuration, optionally keeping a warm cache.
static func ephemeral(cacheDirectory: String? = nil) -> TorConfiguration
Parameters
-
cacheDirectory
-
Optional persistent cache path. The cache is not removed on stop, so this is the single most effective way to drop subsequent bootstrap times from ~40s to ~5–10s.
Return Value
A TorConfiguration that fully disposes of its data directory on shutdown while optionally reusing a warm cache.
Mentioned In
Discussion
Intended for per-session embedded Tor usage where the caller wants zero residual state on disk after stop() returns. Internally: UUID-suffixed temp directory, ownsDataDirectory set to true, and cacheDirectory optionally pointed at a caller-owned warm cache.
Important
The cache directory is shared across sessions and must survive process death. Store it under a stable app-scoped path (not tmp).