pub struct TtlConfig {
pub default_seconds: Option<u64>,
pub namespace: TtlNamespaceConfig,
pub scope: TtlScopeConfig,
}Expand description
Runtime TTL (Time-To-Live) configuration.
Controls memory expiration with domain-scoped and per-namespace defaults. TTL values are stored in seconds (0 means no expiration).
§Defaults
default_seconds: None (no expiration)- All namespace/scope overrides: None (inherit from default)
§Environment Variables
| Variable | Description | Example |
|---|---|---|
SUBCOG_TTL_DEFAULT | Default TTL | “30d”, “0” |
§Priority Order (highest to lowest)
- Explicit
--ttlflag on capture command - Per-namespace TTL (e.g.,
ttl.namespace.context = "7d") - Per-scope TTL (e.g.,
ttl.scope.project = "30d") - Global default TTL (e.g.,
ttl.default = "30d") - No expiration (if nothing configured)
Fields§
§default_seconds: Option<u64>Default TTL in seconds for all memories (None = no expiration, 0 = no expiration).
namespace: TtlNamespaceConfigPer-namespace TTL overrides in seconds.
scope: TtlScopeConfigPer-scope TTL overrides in seconds.
Implementations§
Source§impl TtlConfig
impl TtlConfig
Sourcepub fn from_config_file(file: &ConfigFileTtl) -> Self
pub fn from_config_file(file: &ConfigFileTtl) -> Self
Creates configuration from config file settings.
Sourcepub fn with_env_overrides(self) -> Self
pub fn with_env_overrides(self) -> Self
Applies environment variable overrides.
Sourcepub fn get_ttl_seconds(&self, namespace: &str, scope: &str) -> Option<u64>
pub fn get_ttl_seconds(&self, namespace: &str, scope: &str) -> Option<u64>
Gets the effective TTL in seconds for a given namespace and scope.
Returns None if no TTL is configured (memory never expires).
Returns Some(0) if explicitly set to never expire.
Priority order:
- Per-namespace TTL
- Per-scope TTL
- Global default TTL
Sourcepub const fn with_default_seconds(self, seconds: Option<u64>) -> Self
pub const fn with_default_seconds(self, seconds: Option<u64>) -> Self
Sets the default TTL in seconds.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TtlConfig
impl RefUnwindSafe for TtlConfig
impl Send for TtlConfig
impl Sync for TtlConfig
impl Unpin for TtlConfig
impl UnwindSafe for TtlConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].