pub struct CacheKeyGenerator;Expand description
Cache key generator for document cache
Implementations§
Source§impl CacheKeyGenerator
impl CacheKeyGenerator
Sourcepub fn crate_html_cache_key(crate_name: &str, version: Option<&str>) -> String
pub fn crate_html_cache_key(crate_name: &str, version: Option<&str>) -> String
Build a raw crate HTML cache key with normalization.
This key stores the fetched docs.rs HTML artifact shared across markdown, text, and html responses for the same crate lookup.
Key format: crate:{name}:html or crate:{name}:{version}:html
Sourcepub fn crate_cache_key(crate_name: &str, version: Option<&str>) -> String
pub fn crate_cache_key(crate_name: &str, version: Option<&str>) -> String
Build crate cache key with normalization
§Normalization rules
crate_name: lowercase, trimmed (crate names are case-insensitive on crates.io)version: lowercase, trimmed- Invalid characters in
crate_name(non-alphanumeric, non-underscore, non-hyphen) will result in a hashed key to prevent injection
Sourcepub fn search_cache_key(query: &str, limit: u32, sort: Option<&str>) -> String
pub fn search_cache_key(query: &str, limit: u32, sort: Option<&str>) -> String
Build search cache key with normalization
§Normalization rules
- query: lowercase, trimmed (search is case-insensitive)
- sort: lowercase, trimmed
Sourcepub fn item_cache_key(
crate_name: &str,
item_path: &str,
version: Option<&str>,
) -> String
pub fn item_cache_key( crate_name: &str, item_path: &str, version: Option<&str>, ) -> String
Build item cache key with normalization
§Normalization rules
crate_name: lowercase, trimmed (crate names are case-insensitive on crates.io)item_path: trimmed but case-sensitive (Rust paths are case-sensitive)version: lowercase, trimmed
Sourcepub fn item_html_cache_key(
crate_name: &str,
item_path: &str,
version: Option<&str>,
) -> String
pub fn item_html_cache_key( crate_name: &str, item_path: &str, version: Option<&str>, ) -> String
Build a raw item HTML cache key with normalization.
This key stores the fetched docs.rs search-result HTML artifact shared across markdown, text, and html responses for the same item lookup.
Key format: item:{crate}:{path}:html or item:{crate}:{version}:{path}:html
Auto Trait Implementations§
impl Freeze for CacheKeyGenerator
impl RefUnwindSafe for CacheKeyGenerator
impl Send for CacheKeyGenerator
impl Sync for CacheKeyGenerator
impl Unpin for CacheKeyGenerator
impl UnsafeUnpin for CacheKeyGenerator
impl UnwindSafe for CacheKeyGenerator
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