pub struct CacheConfig {
pub cache_type: String,
pub memory_size: Option<usize>,
pub redis_url: Option<String>,
pub key_prefix: String,
pub default_ttl: Option<u64>,
pub crate_docs_ttl_secs: Option<u64>,
pub item_docs_ttl_secs: Option<u64>,
pub search_results_ttl_secs: Option<u64>,
}Expand description
Cache configuration
Configure cache type, size, TTL, and other parameters.
§Fields
cache_type: Cache type,"memory"or"redis"memory_size: Memory cache size(number of entries)redis_url: Redis connection URLkey_prefix: Key prefix (used to isolate caches of different services)default_ttl: Default TTL (seconds)crate_docs_ttl_secs: Crate document cache TTL (seconds)item_docs_ttl_secs: Item document cache TTL (seconds)search_results_ttl_secs: Search result cache TTL (seconds)
§Hot reload support
§Hot reload supported fields ✅
TTL-related fields can be dynamically updated at runtime (affecting newly written cache entries):
default_ttl: Default TTL (seconds)crate_docs_ttl_secs: Crate document cache TTL (seconds)item_docs_ttl_secs: Item document cache TTL (seconds)search_results_ttl_secs: Search result cache TTL (seconds)
§Hot reload NOT supported fields ❌
The following fields require server restart to take effect:
cache_type: Cache type (involves cache instance creation)memory_size: Memory cache size(initialization parameter)redis_url: Redis connection URL(connection pool initialization)key_prefix: Cache key prefix(initialization parameter)
Reason: These configurations involve initialization of cache backend (memory/Redis) and connection pool creation.
Fields§
§cache_type: StringCache type: memory or redis
memory_size: Option<usize>Memory cache size(number of entries)
redis_url: Option<String>Redis connection URL
key_prefix: StringRedis cache key prefix (used to isolate caches of different services)
default_ttl: Option<u64>Default TTL (seconds)
crate_docs_ttl_secs: Option<u64>Crate document cache TTL (seconds)
item_docs_ttl_secs: Option<u64>Item document cache TTL (seconds)
search_results_ttl_secs: Option<u64>Search result cache TTL (seconds)
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CacheConfig
impl Debug for CacheConfig
Source§impl Default for CacheConfig
impl Default for CacheConfig
Source§impl<'de> Deserialize<'de> for CacheConfig
impl<'de> Deserialize<'de> for CacheConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin for CacheConfig
impl UnsafeUnpin for CacheConfig
impl UnwindSafe for CacheConfig
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