pub trait PipelineCacheStore: Send + Sync {
// Required methods
fn get(&self, fp: &PipelineFingerprint) -> Option<Vec<u8>>;
fn put(&self, fp: PipelineFingerprint, artifact: Vec<u8>);
// Provided methods
fn get_arc(&self, fp: &PipelineFingerprint) -> Option<Arc<Vec<u8>>> { ... }
fn flush(&self) -> Result<()> { ... }
fn metrics(&self) -> PipelineCacheMetrics { ... }
}Expand description
Trait for persistent pipeline-cache backends. super::DiskCache and
super::RemoteCache (when the remote feature is enabled) ship
disk- and network-backed implementations; tests here use the
in-memory super::InMemoryPipelineCache.
Required Methods§
Sourcefn get(&self, fp: &PipelineFingerprint) -> Option<Vec<u8>>
fn get(&self, fp: &PipelineFingerprint) -> Option<Vec<u8>>
Look up a cached artifact for this fingerprint.
This method is required so cache implementations cannot accidentally
inherit a mutually recursive get / get_arc pair. Hot-path consumers
should call Self::get_arc when they can share the payload.
Sourcefn put(&self, fp: PipelineFingerprint, artifact: Vec<u8>)
fn put(&self, fp: PipelineFingerprint, artifact: Vec<u8>)
Insert a pre-compiled artifact. Implementations may dedupe or evict per their own policy.
Provided Methods§
Sourcefn get_arc(&self, fp: &PipelineFingerprint) -> Option<Arc<Vec<u8>>>
fn get_arc(&self, fp: &PipelineFingerprint) -> Option<Arc<Vec<u8>>>
V7-PERF-009: zero-clone hot-path lookup. Returns the cached artifact as
an Arc<Vec<u8>> so multiple consumers share the underlying allocation.
Default impl wraps get; in-memory and layered caches override this to
return their internal Arc directly.
Sourcefn metrics(&self) -> PipelineCacheMetrics
fn metrics(&self) -> PipelineCacheMetrics
Snapshot cache instrumentation for latency, throughput, and eviction gates. Backends that do not maintain counters return zeros.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".