1use crate::access::init_predicate_exists;
2use essential_types::{solution::Solution, Hash};
3use std::{collections::HashSet, sync::OnceLock};
4
5#[derive(Default, Debug, PartialEq)]
6pub struct LazyCache {
8    pub pred_data_hashes: OnceLock<HashSet<Hash>>,
11}
12
13impl LazyCache {
14    pub fn new() -> Self {
16        Self::default()
17    }
18
19    pub fn get_pred_data_hashes(&self, solutions: &[Solution]) -> &HashSet<Hash> {
23        self.pred_data_hashes
24            .get_or_init(|| init_predicate_exists(solutions).collect())
25    }
26}