pub struct WorkloadClassifier { /* private fields */ }Expand description
Workload classifier
Implementations§
Source§impl WorkloadClassifier
impl WorkloadClassifier
Sourcepub fn new(config: DistribCacheConfig) -> Self
pub fn new(config: DistribCacheConfig) -> Self
Create a new workload classifier
Sourcepub fn classify(&self, query: &str, context: &QueryContext) -> WorkloadType
pub fn classify(&self, query: &str, context: &QueryContext) -> WorkloadType
Classify a query based on patterns and session history
Sourcepub fn classify_query(
&self,
query: &str,
context: &QueryContext,
) -> WorkloadType
pub fn classify_query( &self, query: &str, context: &QueryContext, ) -> WorkloadType
Simplified classify method for string queries
Sourcepub fn record_latency(&self, session_id: &SessionId, latency_ms: u64)
pub fn record_latency(&self, session_id: &SessionId, latency_ms: u64)
Record query latency (call after execution)
Sourcepub fn add_rule(&mut self, rule: ClassificationRule)
pub fn add_rule(&mut self, rule: ClassificationRule)
Add a custom classification rule
Sourcepub fn stats(&self) -> ClassifierStatsSnapshot
pub fn stats(&self) -> ClassifierStatsSnapshot
Get classifier statistics
Sourcepub fn cleanup_old_sessions(&self, max_age: Duration)
pub fn cleanup_old_sessions(&self, max_age: Duration)
Clear session history older than threshold
Auto Trait Implementations§
impl !Freeze for WorkloadClassifier
impl !RefUnwindSafe for WorkloadClassifier
impl Send for WorkloadClassifier
impl Sync for WorkloadClassifier
impl Unpin for WorkloadClassifier
impl UnsafeUnpin for WorkloadClassifier
impl UnwindSafe for WorkloadClassifier
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> 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