Skip to main content

Crate sigstore_cache

Crate sigstore_cache 

Source
Expand description

Flexible caching support for Sigstore clients

This crate provides a pluggable caching mechanism for Sigstore operations. It allows users to choose between different caching strategies:

  • FileSystemCache: Persistent cache stored on disk (default location or custom)
  • InMemoryCache: Fast in-process cache with TTL support
  • NoCache: Disabled caching (for testing or when caching is not desired)

§Example

use sigstore_cache::{FileSystemCache, CacheAdapter, CacheKey};
use std::time::Duration;

// Use default cache location (~/.cache/sigstore-rust/)
let cache = FileSystemCache::default_location()?;

// Or specify a custom directory
let cache = FileSystemCache::new("/tmp/my-cache")?;

// Store a value with TTL
cache.set(CacheKey::RekorPublicKey, b"public-key-data", Duration::from_secs(86400)).await?;

// Retrieve the value
if let Some(data) = cache.get(CacheKey::RekorPublicKey).await? {
    println!("Got cached data: {} bytes", data.len());
}

Structs§

FileSystemCache
File system based cache
InMemoryCache
In-memory cache with TTL support
NoCache
A no-op cache that doesn’t store anything

Enums§

CacheKey
Cache keys for different Sigstore resources
Error
Errors that can occur during cache operations

Constants§

SIGSTORE_PRODUCTION_URL
Sigstore production instance base URL
SIGSTORE_STAGING_URL
Sigstore staging instance base URL

Traits§

CacheAdapter
Trait for cache adapters
CacheAdapterExt
Extension trait providing convenience methods for caching

Functions§

default_cache_dir
Get the default cache directory for sigstore-rust

Type Aliases§

CacheGetFuture
Future type for cache get operations
CacheOpFuture
Future type for cache set/remove/clear operations
Result
Result type for cache operations