Skip to main content

Mountain/IPC/AdvancedFeatures/
mountain_get_cache_stats.rs

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