Skip to main content

jellyflow_runtime/io/tuning/
paint_cache.rs

1use serde::{Deserialize, Serialize};
2
3/// Tuning reserved for renderer/runtime paint-cache pruning.
4///
5/// The headless runtime does not own renderer paint caches today. Keep this payload serialized so
6/// adapters and future cache plumbing can share stable defaults without graph-schema churn.
7#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
8pub struct NodeGraphPaintCachePruneTuning {
9    /// Remove cache entries not used within this many frames.
10    #[serde(default = "NodeGraphPaintCachePruneTuning::default_max_age_frames")]
11    pub max_age_frames: u64,
12    /// Hard cap on total cache entries (paths + markers + text blobs + text metrics).
13    #[serde(default = "NodeGraphPaintCachePruneTuning::default_max_entries")]
14    pub max_entries: usize,
15}
16
17impl NodeGraphPaintCachePruneTuning {
18    fn default_max_age_frames() -> u64 {
19        300
20    }
21
22    fn default_max_entries() -> usize {
23        30_000
24    }
25}
26
27impl Default for NodeGraphPaintCachePruneTuning {
28    fn default() -> Self {
29        Self {
30            max_age_frames: Self::default_max_age_frames(),
31            max_entries: Self::default_max_entries(),
32        }
33    }
34}