pub struct OffloadRepository { /* private fields */ }Expand description
CacheRepository decorator that offloads entry payloads to a
PayloadStore.
Wraps any index backend; see the module docs for the blob
lifecycle and failure policy. stale_retention, sweep_interval, and
payload_max_ttl must be non-zero (the payload intervals at least one
second — the death epoch truncates to whole seconds) — enforced by
CacheRepoConfig validation, not here.
Implementations§
Source§impl OffloadRepository
impl OffloadRepository
Sourcepub fn new(
inner: Arc<dyn CacheRepository>,
store: Arc<dyn PayloadStore>,
stale_retention: Duration,
sweep_interval: Duration,
payload_max_ttl: Duration,
) -> Self
pub fn new( inner: Arc<dyn CacheRepository>, store: Arc<dyn PayloadStore>, stale_retention: Duration, sweep_interval: Duration, payload_max_ttl: Duration, ) -> Self
Wrap inner with payload offload through store (production
clock).
Sourcepub fn with_clock(
inner: Arc<dyn CacheRepository>,
store: Arc<dyn PayloadStore>,
stale_retention: Duration,
sweep_interval: Duration,
payload_max_ttl: Duration,
clock: OffloadClock,
) -> Self
pub fn with_clock( inner: Arc<dyn CacheRepository>, store: Arc<dyn PayloadStore>, stale_retention: Duration, sweep_interval: Duration, payload_max_ttl: Duration, clock: OffloadClock, ) -> Self
Test seam: Self::new with an injected OffloadClock.
The injected clock drives death-epoch math only; the store’s own reclaim machinery (sweeper, TTL) always runs on the real clock.
Trait Implementations§
Source§impl CacheRepository for OffloadRepository
impl CacheRepository for OffloadRepository
Source§fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delegate-only: the index row is dropped here; the payload becomes an orphan reclaimed asynchronously at its name-encoded death epoch.
Source§fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reclaim payload space now: best-effort bulk reclamation in the
store, then delegate to the index. Store failures never turn
clear into Err — the store WARNs per payload and continues
(PayloadStore::clear contract).
Source§fn invalidate_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64, CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn invalidate_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64, CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delegate-only: the returned count is index-scoped; payloads are reclaimed asynchronously at their name-encoded death epoch.
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>, CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>, CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn set<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
entry: CacheEntry,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
entry: CacheEntry,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn peek_stale<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>, CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn peek_stale<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>, CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CacheStats> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CacheStats> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn peek_row_silent<'life0, 'life1, 'async_trait>(
&'life0 self,
_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>, CamelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn peek_row_silent<'life0, 'life1, 'async_trait>(
&'life0 self,
_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheEntry>, CamelError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
key
regardless of expiry WITHOUT mutating any observable statistic
(hits, misses, peek_stale_served). For internal
bookkeeping such as the disk-offload decorator’s predecessor
reclaim; application reads must use get or peek_stale. Read more