pub struct CachekitConfig {
pub api_key: Option<Zeroizing<String>>,
pub api_url: String,
pub master_key: Option<Zeroizing<Vec<u8>>>,
pub previous_master_keys: Vec<Zeroizing<Vec<u8>>>,
pub default_ttl: Duration,
pub namespace: Option<String>,
pub l1_capacity: usize,
pub max_payload_bytes: usize,
}Expand description
Runtime configuration for a crate::client::CacheKit instance.
Fields§
§api_key: Option<Zeroizing<String>>API key for cachekit.io authentication.
api_url: StringBase URL of the cachekit.io API.
master_key: Option<Zeroizing<Vec<u8>>>Master key used for zero-knowledge encryption (AES-256-GCM).
previous_master_keys: Vec<Zeroizing<Vec<u8>>>Decrypt-only previous master keys retained during a rotation grace
window, in attempt order. Writes always use master_key; reads
attempt it first, then these, sequentially. At most
MAX_PREVIOUS_MASTER_KEYS entries.
default_ttl: DurationDefault TTL for cache entries when none is specified at call site.
namespace: Option<String>Optional namespace prefix applied to all cache keys.
l1_capacity: usizeMaximum number of entries in the L1 in-process cache.
max_payload_bytes: usizeMaximum allowed payload size in bytes. Larger payloads are rejected.
Implementations§
Source§impl CachekitConfig
impl CachekitConfig
Sourcepub fn from_env() -> Result<Self, CachekitError>
pub fn from_env() -> Result<Self, CachekitError>
Build configuration from environment variables.
| Variable | Description |
|---|---|
CACHEKIT_API_KEY | API key for cachekit.io |
CACHEKIT_API_URL | Override API base URL (must be HTTPS) |
CACHEKIT_MASTER_KEY | Hex-encoded master key (min 32 bytes) |
CACHEKIT_PREVIOUS_MASTER_KEYS | Comma-separated hex-encoded decrypt-only previous master keys (max 3; blank value = unset) |
CACHEKIT_DEFAULT_TTL | Default TTL in seconds (min 1) |
Trait Implementations§
Source§impl Debug for CachekitConfig
impl Debug for CachekitConfig
Auto Trait Implementations§
impl Freeze for CachekitConfig
impl RefUnwindSafe for CachekitConfig
impl Send for CachekitConfig
impl Sync for CachekitConfig
impl Unpin for CachekitConfig
impl UnsafeUnpin for CachekitConfig
impl UnwindSafe for CachekitConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more