pub struct FlagCache { /* private fields */ }Expand description
Thread-safe cache for feature flag definitions.
Stores feature flags, group type mappings, and cohort definitions that have been fetched from the PostHog API. The cache is shared between the poller (which updates it) and the evaluator (which reads from it).
Implementations§
Source§impl FlagCache
impl FlagCache
pub fn new() -> Self
pub fn update(&self, response: LocalEvaluationResponse)
pub fn get_flag(&self, key: &str) -> Option<FeatureFlag>
pub fn get_all_flags(&self) -> Vec<FeatureFlag>
pub fn get_cohort(&self, id: &str) -> Option<Cohort>
pub fn get_all_cohorts(&self) -> HashMap<String, Cohort>
Sourcepub fn get_cohort_definitions(&self) -> HashMap<String, CohortDefinition>
pub fn get_cohort_definitions(&self) -> HashMap<String, CohortDefinition>
Get all cohorts as CohortDefinitions for evaluation context
Sourcepub fn get_flags_map(&self) -> HashMap<String, FeatureFlag>
pub fn get_flags_map(&self) -> HashMap<String, FeatureFlag>
Get all flags as a HashMap for evaluation context
pub fn clear(&self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FlagCache
impl RefUnwindSafe for FlagCache
impl Send for FlagCache
impl Sync for FlagCache
impl Unpin for FlagCache
impl UnwindSafe for FlagCache
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