pub struct DefaultKvCacheManager { /* private fields */ }Expand description
Default KV cache manager - MVP implementation
Implementations§
Trait Implementations§
Source§impl Debug for DefaultKvCacheManager
impl Debug for DefaultKvCacheManager
Source§impl KvCacheManager for DefaultKvCacheManager
impl KvCacheManager for DefaultKvCacheManager
Source§fn allocate<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 AllocationRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvCacheHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn allocate<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 AllocationRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvCacheHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Allocate cache for new sequence
Source§fn extend<'life0, 'life1, 'async_trait>(
&'life0 self,
_handle: &'life1 mut dyn KvCacheHandle,
_additional_tokens: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn extend<'life0, 'life1, 'async_trait>(
&'life0 self,
_handle: &'life1 mut dyn KvCacheHandle,
_additional_tokens: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Extend existing cache to accommodate more tokens
Source§fn deallocate<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn deallocate<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deallocate cache (handle becomes invalid)
Source§fn can_allocate(&self, _request: &AllocationRequest) -> bool
fn can_allocate(&self, _request: &AllocationRequest) -> bool
Check if can allocate requested cache size
Source§fn stats(&self) -> CacheManagerStats
fn stats(&self) -> CacheManagerStats
Get cache statistics
Source§fn gc<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CacheGcStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn gc<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CacheGcStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Force garbage collection of unused caches
Source§fn set_pressure_callback(
&self,
callback: Box<dyn Fn(MemoryPressure) + Send + Sync>,
)
fn set_pressure_callback( &self, callback: Box<dyn Fn(MemoryPressure) + Send + Sync>, )
Set memory pressure callback
Source§fn get_handle(&self, request_id: RequestId) -> Option<Arc<dyn KvCacheHandle>>
fn get_handle(&self, request_id: RequestId) -> Option<Arc<dyn KvCacheHandle>>
Get handle for existing request (if exists)
Source§fn list_handles(&self) -> Vec<(RequestId, Arc<dyn KvCacheHandle>)>
fn list_handles(&self) -> Vec<(RequestId, Arc<dyn KvCacheHandle>)>
List all active cache handles
Auto Trait Implementations§
impl !Freeze for DefaultKvCacheManager
impl !RefUnwindSafe for DefaultKvCacheManager
impl !UnwindSafe for DefaultKvCacheManager
impl Send for DefaultKvCacheManager
impl Sync for DefaultKvCacheManager
impl Unpin for DefaultKvCacheManager
impl UnsafeUnpin for DefaultKvCacheManager
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