feat: add cache toggle, unregister API and chunk training docs

- Add POST /api/v1/config/cache for cache toggle
- Add POST /api/v1/unregister for video deletion
- Add CHUNK_DATA_STRUCTURE.md for marcom training
- Fix processor_results query in delete_video
This commit is contained in:
Warren
2026-03-25 15:44:47 +08:00
parent de80b96c15
commit e4d3365ada
4 changed files with 409 additions and 0 deletions
+18
View File
@@ -1,5 +1,23 @@
use once_cell::sync::Lazy;
use std::env;
use std::sync::RwLock;
pub static RUNTIME_CACHE_ENABLED: Lazy<RwLock<bool>> = Lazy::new(|| {
let initial = env::var("MONGODB_CACHE_ENABLED")
.unwrap_or_else(|_| "true".to_string())
.parse()
.unwrap_or(true);
RwLock::new(initial)
});
pub fn get_cache_enabled() -> bool {
*RUNTIME_CACHE_ENABLED.read().unwrap()
}
pub fn set_cache_enabled(enabled: bool) {
*RUNTIME_CACHE_ENABLED.write().unwrap() = enabled;
tracing::info!("Cache enabled set to: {}", enabled);
}
pub static DATABASE_URL: Lazy<String> = Lazy::new(|| {
env::var("DATABASE_URL")