Skip to main content

offline_intelligence/
lib.rs

1// _Aud.io/offline-intelligence/crates/src/lib.rs
2
3pub mod admin;
4pub mod api;
5pub mod backend_target;
6pub mod config;
7pub mod context_engine;
8pub mod memory;
9pub mod memory_db;
10pub mod metrics;
11pub mod resources;
12pub mod cache_management;
13pub mod telemetry;
14pub mod utils;
15pub mod shared_state;
16pub mod thread_pool;
17pub mod worker_threads;
18pub mod thread_server;
19pub mod model_runtime;
20pub mod model_management;
21pub mod engine_management;
22
23pub use admin::*;
24pub use backend_target::*;
25pub use config::*;
26pub use metrics::*;
27pub use cache_management::*;
28pub use thread_server::*;
29
30use std::sync::Arc;
31use tracing::{info, warn};
32
33use memory_db::MemoryDatabase;
34
35async fn init_cache_manager(
36    memory_database: Arc<MemoryDatabase>,
37) -> anyhow::Result<Option<Arc<cache_management::KVCacheManager>>> {
38    let cache_config = cache_management::KVCacheConfig::default();
39    
40    match KVCacheManager::new(cache_config, memory_database) {
41        Ok(manager) => {
42            info!("Cache manager initialized successfully");
43            Ok(Some(Arc::new(manager)))
44        }
45        Err(e) => {
46            warn!("Failed to initialize cache manager: {}, cache features disabled", e);
47            Ok(None)
48        }
49    }
50}