Enum fred::types::ClusterHash
source · pub enum ClusterHash {
FirstKey,
FirstValue,
Random,
Offset(usize),
Custom(u16),
}Expand description
A cluster hashing policy.
Variants§
FirstKey
Hash the first string or bytes value in the arguments. (Default)
FirstValue
Hash the first argument regardless of type.
Random
Use a random node in the cluster.
Offset(usize)
Hash the value with the provided offset in the arguments array.
Custom(u16)
Provide a custom hash slot value.
Implementations§
source§impl ClusterHash
impl ClusterHash
sourcepub fn hash(&self, args: &[RedisValue]) -> Option<u16>
pub fn hash(&self, args: &[RedisValue]) -> Option<u16>
Hash the provided arguments.
sourcepub fn find_key<'a>(&self, args: &'a [RedisValue]) -> Option<&'a [u8]>
pub fn find_key<'a>(&self, args: &'a [RedisValue]) -> Option<&'a [u8]>
Find the key to hash with the provided arguments.
Trait Implementations§
source§impl Clone for ClusterHash
impl Clone for ClusterHash
source§fn clone(&self) -> ClusterHash
fn clone(&self) -> ClusterHash
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for ClusterHash
impl Debug for ClusterHash
source§impl Default for ClusterHash
impl Default for ClusterHash
source§impl From<&[u8]> for ClusterHash
impl From<&[u8]> for ClusterHash
source§impl From<&str> for ClusterHash
impl From<&str> for ClusterHash
source§impl From<u16> for ClusterHash
impl From<u16> for ClusterHash
source§impl PartialEq for ClusterHash
impl PartialEq for ClusterHash
impl Eq for ClusterHash
impl StructuralPartialEq for ClusterHash
Auto Trait Implementations§
impl Freeze for ClusterHash
impl RefUnwindSafe for ClusterHash
impl Send for ClusterHash
impl Sync for ClusterHash
impl Unpin for ClusterHash
impl UnwindSafe for ClusterHash
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)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more