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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user