Skip to main content

Mountain/IPC/AdvancedFeatures/
mountain_get_cache_stats.rs

1//! `mountain_get_cache_stats` Tauri command - returns the
2//! `MessageCache::Struct` snapshot (entries + hit / miss
3//! counters).
4
5use tauri::Manager;
6
7use crate::{
8	IPC::AdvancedFeatures::{Features::Struct as Features, MessageCache::Struct as MessageCache},
9	dev_log,
10};
11
12#[tauri::command]
13pub async fn mountain_get_cache_stats(app_handle:tauri::AppHandle) -> Result<MessageCache, String> {
14	dev_log!("lifecycle", "Tauri command: get_cache_stats");
15
16	if let Some(features) = app_handle.try_state::<Features>() {
17		features.get_cache_stats().await
18	} else {
19		Err("AdvancedFeatures not found in application state".to_string())
20	}
21}