pub struct VolatileMemory { /* private fields */ }Expand description
Volatile memory ring retaining the most recent records.
Implementations§
Source§impl VolatileMemory
impl VolatileMemory
Sourcepub fn new(config: VolatileConfig) -> Self
pub fn new(config: VolatileConfig) -> Self
Creates a new buffer using the supplied configuration.
Sourcepub async fn push(&self, record: MemoryRecord)
pub async fn push(&self, record: MemoryRecord)
Inserts a record, evicting the oldest entries if capacity constraints are exceeded.
Sourcepub async fn recent(&self, limit: usize) -> Vec<MemoryRecord>
pub async fn recent(&self, limit: usize) -> Vec<MemoryRecord>
Returns the most recent records up to the requested limit.
Sourcepub async fn stats(&self) -> VolatileStats
pub async fn stats(&self) -> VolatileStats
Returns statistics about the buffer utilisation.