feat: actor cache TTL with staleness-aware re-fetch

Adds fetched_at to RemoteActor, configurable TTL via builder
(.actor_cache_ttl_secs, default 24h), and get_or_refresh_remote_actor
helper that re-fetches stale actors from origin.

Closes #3
This commit is contained in:
2026-05-30 02:46:54 +02:00
parent f08d11034d
commit 7171a1791a
8 changed files with 69 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ pub struct FederationData {
pub(crate) allow_registration: bool,
pub(crate) software_name: String,
pub(crate) event_publisher: Option<Arc<dyn EventPublisher>>,
pub(crate) actor_cache_ttl: std::time::Duration,
}
impl FederationData {
@@ -79,6 +80,7 @@ impl FederationData {
allow_registration: bool,
software_name: String,
event_publisher: Option<Arc<dyn EventPublisher>>,
actor_cache_ttl: std::time::Duration,
) -> Self {
let domain = base_url
.trim_start_matches("https://")
@@ -100,6 +102,7 @@ impl FederationData {
allow_registration,
software_name,
event_publisher,
actor_cache_ttl,
}
}
}