pub struct CacheKey {
pub user_tag: String,
/* private fields */
}
Expand description
General purpose cache key
Fields§
§user_tag: String
An extra tag for identifying users
For example, if the storage backend implements per user quota, this tag can be used.
Implementations§
Source§impl CacheKey
impl CacheKey
Sourcepub fn set_variance_key(&mut self, key: HashBinary)
pub fn set_variance_key(&mut self, key: HashBinary)
Set the value of the variance hash
Sourcepub fn get_variance_key(&self) -> Option<&HashBinary>
pub fn get_variance_key(&self) -> Option<&HashBinary>
Get the value of the variance hash
Sourcepub fn remove_variance_key(&mut self)
pub fn remove_variance_key(&mut self)
Removes the variance from this cache key
Sourcepub fn set_primary_bin_override(&mut self, key: HashBinary)
pub fn set_primary_bin_override(&mut self, key: HashBinary)
Override the primary key hash
Source§impl CacheKey
impl CacheKey
Sourcepub fn default(req_header: &ReqHeader) -> Self
pub fn default(req_header: &ReqHeader) -> Self
Create a default CacheKey from a request, which just takes it URI as the primary key.
Sourcepub fn new<S1, S2, S3>(namespace: S1, primary: S2, user_tag: S3) -> Self
pub fn new<S1, S2, S3>(namespace: S1, primary: S2, user_tag: S3) -> Self
Create a new CacheKey from the given namespace, primary, and user_tag string.
Both namespace
and primary
will be used for the primary hash
Sourcepub fn primary_key(&self) -> &str
pub fn primary_key(&self) -> &str
Return the primary key of this key
Sourcepub fn to_compact(&self) -> CompactCacheKey
pub fn to_compact(&self) -> CompactCacheKey
Convert this key to CompactCacheKey.
Trait Implementations§
Source§impl CacheHashKey for CacheKey
impl CacheHashKey for CacheKey
Source§fn primary_bin(&self) -> HashBinary
fn primary_bin(&self) -> HashBinary
Return the hash of the cache key
Source§fn variance_bin(&self) -> Option<HashBinary>
fn variance_bin(&self) -> Option<HashBinary>
Return the variance hash of the cache key. Read more
Source§fn combined_bin(&self) -> HashBinary
fn combined_bin(&self) -> HashBinary
Return the hash including both primary and variance keys
Source§fn primary(&self) -> String
fn primary(&self) -> String
The hex string of Self::primary_bin()
Source§fn combined(&self) -> String
fn combined(&self) -> String
The hex string of Self::combined_bin()
Auto Trait Implementations§
impl Freeze for CacheKey
impl RefUnwindSafe for CacheKey
impl Send for CacheKey
impl Sync for CacheKey
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)