pub struct Cache { /* private fields */ }
Expand description
Client for the cache API.
Reusing a single client for multiple requests is potentially more efficient due to connection reuse.
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn new(user_agent: &str) -> Result<Self>
pub fn new(user_agent: &str) -> Result<Self>
Creates a new client instance.
The passed user_agent
should identify the program using this library.
Sourcepub async fn get_url(
&self,
key_space: &str,
key_prefixes: &[&str],
) -> Result<Option<(CacheHit, String)>>
pub async fn get_url( &self, key_space: &str, key_prefixes: &[&str], ) -> Result<Option<(CacheHit, String)>>
Performs a cache lookup and returns the URL for a matching entry.
key_space
- parameter is an identifier, usually a hex string, which must match exactlykey_prefixes
- list of key prefixes to look up in order of preference
See the official documentation for the precedence in case of multiple matching entries.
Note that key_space
is not exposed by the official client and thus not mentioned there.
Auto Trait Implementations§
impl Freeze for Cache
impl !RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl !UnwindSafe for Cache
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