pub struct CacheKey { /* private fields */ }Expand description
The identity of a cached request: service namespace, kind, endpoint name and normalized parameters. Two keys with the same identity share an entry.
Implementations§
Source§impl CacheKey
impl CacheKey
Sourcepub fn new(
namespace: impl Into<String>,
kind: CacheKind,
endpoint: impl Into<String>,
) -> Self
pub fn new( namespace: impl Into<String>, kind: CacheKind, endpoint: impl Into<String>, ) -> Self
namespace is the service ("food", "mart"); endpoint names the
call ("search", "merchant"), not the full URL.
Sourcepub fn param(self, name: impl Into<String>, value: impl Display) -> Self
pub fn param(self, name: impl Into<String>, value: impl Display) -> Self
Add a parameter. Order doesn’t matter; surrounding/repeated whitespace in the value is collapsed. Values are otherwise case-sensitive — lowercase them first if the upstream is case-insensitive.
Sourcepub fn location(self, latitude: f64, longitude: f64) -> Self
pub fn location(self, latitude: f64, longitude: f64) -> Self
Add the delivery location, rounded to 4 decimals (~11 m).
pub fn kind(&self) -> CacheKind
pub fn namespace(&self) -> &str
Trait Implementations§
impl Eq for CacheKey
impl StructuralPartialEq for CacheKey
Auto Trait Implementations§
impl Freeze for CacheKey
impl RefUnwindSafe for CacheKey
impl Send for CacheKey
impl Sync for CacheKey
impl Unpin for CacheKey
impl UnsafeUnpin for CacheKey
impl UnwindSafe for CacheKey
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