pub struct CachePutCtx<C: CachePut> { /* private fields */ }
Expand description
The cache put context
Implementations§
Source§impl<C: CachePut> CachePutCtx<C>
impl<C: CachePut> CachePutCtx<C>
Sourcepub fn new(
cache_put: C,
key: CacheKey,
storage: &'static (dyn Storage + Sync),
eviction: Option<&'static (dyn EvictionManager + Sync)>,
trace: Span,
) -> Self
pub fn new( cache_put: C, key: CacheKey, storage: &'static (dyn Storage + Sync), eviction: Option<&'static (dyn EvictionManager + Sync)>, trace: Span, ) -> Self
Create a new CachePutCtx
Sourcepub fn set_max_file_size_bytes(&mut self, max_file_size_bytes: usize)
pub fn set_max_file_size_bytes(&mut self, max_file_size_bytes: usize)
Set the max cacheable size limit
Sourcepub async fn cache_put(
&mut self,
session: &mut ServerSession,
) -> Result<Option<NoCacheReason>>
pub async fn cache_put( &mut self, session: &mut ServerSession, ) -> Result<Option<NoCacheReason>>
Start the cache put logic for the given request
This function will start to read the request body to put into cache. Return:
Ok(None)
when the payload will be cache.Ok(Some(reason))
when the payload is not cacheable
Auto Trait Implementations§
impl<C> !Freeze for CachePutCtx<C>
impl<C> !RefUnwindSafe for CachePutCtx<C>
impl<C> Send for CachePutCtx<C>where
C: Send,
impl<C> Sync for CachePutCtx<C>where
C: Sync,
impl<C> Unpin for CachePutCtx<C>where
C: Unpin,
impl<C> !UnwindSafe for CachePutCtx<C>
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