pub struct RuleCache { /* private fields */ }Expand description
Rule-specific caching system
Implementations§
Source§impl RuleCache
impl RuleCache
Sourcepub fn with_sizes(
rule_cache_size: usize,
derivation_cache_size: usize,
unification_cache_size: usize,
pattern_cache_size: usize,
) -> Self
pub fn with_sizes( rule_cache_size: usize, derivation_cache_size: usize, unification_cache_size: usize, pattern_cache_size: usize, ) -> Self
Create cache with custom sizes
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable caching
Sourcepub fn cache_rule_result(
&self,
rule_name: &str,
input_facts: &[RuleAtom],
result: Vec<RuleAtom>,
)
pub fn cache_rule_result( &self, rule_name: &str, input_facts: &[RuleAtom], result: Vec<RuleAtom>, )
Cache rule execution result
Sourcepub fn get_rule_result(
&self,
rule_name: &str,
input_facts: &[RuleAtom],
) -> Option<Vec<RuleAtom>>
pub fn get_rule_result( &self, rule_name: &str, input_facts: &[RuleAtom], ) -> Option<Vec<RuleAtom>>
Get cached rule result
Sourcepub fn cache_derivation(
&self,
goal: &RuleAtom,
context: &[RuleAtom],
result: bool,
)
pub fn cache_derivation( &self, goal: &RuleAtom, context: &[RuleAtom], result: bool, )
Cache derivation result
Sourcepub fn get_derivation(
&self,
goal: &RuleAtom,
context: &[RuleAtom],
) -> Option<bool>
pub fn get_derivation( &self, goal: &RuleAtom, context: &[RuleAtom], ) -> Option<bool>
Get cached derivation result
Sourcepub fn cache_unification(
&self,
pattern: &str,
bindings: HashMap<String, String>,
)
pub fn cache_unification( &self, pattern: &str, bindings: HashMap<String, String>, )
Cache unification result
Sourcepub fn get_unification(&self, pattern: &str) -> Option<HashMap<String, String>>
pub fn get_unification(&self, pattern: &str) -> Option<HashMap<String, String>>
Get cached unification result
Sourcepub fn cache_pattern(&self, pattern: &str, matches: Vec<RuleAtom>)
pub fn cache_pattern(&self, pattern: &str, matches: Vec<RuleAtom>)
Cache pattern matching result
Sourcepub fn cleanup_expired(&self)
pub fn cleanup_expired(&self)
Clean expired entries from all caches
Sourcepub fn get_statistics(&self) -> CachingStatistics
pub fn get_statistics(&self) -> CachingStatistics
Get combined cache statistics
Sourcepub fn warm_cache(&self, rules: &[Rule], common_facts: &[RuleAtom])
pub fn warm_cache(&self, rules: &[Rule], common_facts: &[RuleAtom])
Warm cache with common patterns
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuleCache
impl RefUnwindSafe for RuleCache
impl Send for RuleCache
impl Sync for RuleCache
impl Unpin for RuleCache
impl UnsafeUnpin for RuleCache
impl UnwindSafe for RuleCache
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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