pub struct ScriptManager { /* private fields */ }Expand description
Manages Lua script loading and caching
Implementations§
Source§impl ScriptManager
impl ScriptManager
Sourcepub async fn record_execution(&self, script_id: ScriptId, duration: Duration)
pub async fn record_execution(&self, script_id: ScriptId, duration: Duration)
Record script execution performance
Sourcepub async fn get_performance(
&self,
script_id: ScriptId,
) -> Option<ScriptPerformance>
pub async fn get_performance( &self, script_id: ScriptId, ) -> Option<ScriptPerformance>
Get performance metrics for a script
Sourcepub async fn get_all_performance(&self) -> HashMap<ScriptId, ScriptPerformance>
pub async fn get_all_performance(&self) -> HashMap<ScriptId, ScriptPerformance>
Get all performance metrics
Sourcepub async fn reset_performance(&self, script_id: ScriptId)
pub async fn reset_performance(&self, script_id: ScriptId)
Reset performance metrics for a specific script
Sourcepub async fn reset_all_performance(&self)
pub async fn reset_all_performance(&self)
Reset all performance metrics
Sourcepub async fn load_all(&self) -> Result<()>
pub async fn load_all(&self) -> Result<()>
Load all scripts into Redis and cache their SHA1 hashes
Sourcepub async fn get_sha(&self, script_id: ScriptId) -> Option<String>
pub async fn get_sha(&self, script_id: ScriptId) -> Option<String>
Get the SHA1 hash for a script
Sourcepub async fn get_script(&self, script_id: ScriptId) -> Option<Script>
pub async fn get_script(&self, script_id: ScriptId) -> Option<Script>
Get a Script object for execution
Sourcepub async fn load_script(&self, script_id: ScriptId) -> Result<String>
pub async fn load_script(&self, script_id: ScriptId) -> Result<String>
Load a single script
Sourcepub async fn is_loaded(&self, script_id: ScriptId) -> Result<bool>
pub async fn is_loaded(&self, script_id: ScriptId) -> Result<bool>
Check if a script is loaded in Redis
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear the script cache (useful for testing or after Redis restart)
Sourcepub async fn stats(&self) -> ScriptStats
pub async fn stats(&self) -> ScriptStats
Get statistics about loaded scripts
Auto Trait Implementations§
impl Freeze for ScriptManager
impl !RefUnwindSafe for ScriptManager
impl Send for ScriptManager
impl Sync for ScriptManager
impl Unpin for ScriptManager
impl UnsafeUnpin for ScriptManager
impl !UnwindSafe for ScriptManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more