pub struct CacheKey {
pub user_tag: String,
pub extensions: Extensions,
/* private fields */
}Expand description
General purpose cache key
Fields§
§user_tag: StringAn extra tag for identifying users
For example, if the storage backend implements per user quota, this tag can be used.
extensions: ExtensionsGrab-bag for user-defined extensions. These will not be persisted to disk.
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
Sourcepub fn primary_key_str(&self) -> Option<&str>
pub fn primary_key_str(&self) -> Option<&str>
Try to get primary key as UTF-8 str, if valid
Sourcepub fn namespace_str(&self) -> Option<&str>
pub fn namespace_str(&self) -> Option<&str>
Try to get namespace key as UTF-8 str, if valid
Source§impl CacheKey
impl CacheKey
Sourcepub fn new<B1, B2, S>(namespace: B1, primary: B2, user_tag: S) -> Self
pub fn new<B1, B2, S>(namespace: B1, primary: B2, user_tag: S) -> Self
Create a new CacheKey from the given namespace, primary, and user_tag input.
Both namespace and primary will be used for the primary hash
Sourcepub fn primary_key(&self) -> &[u8] ⓘ
pub fn primary_key(&self) -> &[u8] ⓘ
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 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