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
Configuration values for a CacheKit client.
A client reads a CachekitConfig on one path only: CacheKit::from_env()
builds one with CachekitConfig::from_env and applies it, except the
key fields: only an explicit encryption call such as
CacheKitBuilder::encryption_from_env() encrypts. No CacheKit
constructor takes a CachekitConfig value, so a config made with
CachekitConfigBuilder configures no client.
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 for zero-knowledge encryption (AES-256-GCM). Key material only: no client encrypts because this is set.
previous_master_keys: Vec<Zeroizing<Vec<u8>>>Decrypt-only previous master keys for a rotation grace window, in
attempt order. At most MAX_PREVIOUS_MASTER_KEYS entries.
These hold key material only. See
CachekitConfigBuilder::previous_master_keys for the paths that
apply previous keys to a client.
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); set but empty, not hex or not UTF-8 is an error, never unset |
CACHEKIT_PREVIOUS_MASTER_KEYS | Comma-separated hex-encoded decrypt-only previous master keys (max 3; blank value = unset) |
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
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> ⓘ
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> ⓘ
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