Skip to main content

vantage_live/cache/
noop.rs

1//! Pass-through cache that never stores anything.
2//!
3//! Useful for parity tests (does the LiveTable wrapper change behaviour vs.
4//! talking to the master directly?) and for opting out of caching at
5//! configuration time without rebuilding the read/write path.
6
7use async_trait::async_trait;
8use vantage_core::Result;
9
10use super::{Cache, CachedRows};
11
12#[derive(Clone, Copy, Debug, Default)]
13pub struct NoCache;
14
15#[async_trait]
16impl Cache for NoCache {
17    async fn get(&self, _key: &str) -> Result<Option<CachedRows>> {
18        Ok(None)
19    }
20
21    async fn put(&self, _key: &str, _rows: CachedRows) -> Result<()> {
22        Ok(())
23    }
24
25    async fn invalidate_prefix(&self, _prefix: &str) -> Result<()> {
26        Ok(())
27    }
28}