Trait deno_cache::Cache

source ·
pub trait Cache: Clone + 'static {
    type CacheMatchResourceType: Resource;

    // Required methods
    fn storage_open<'life0, 'async_trait>(
        &'life0 self,
        cache_name: String
    ) -> Pin<Box<dyn Future<Output = Result<i64, AnyError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn storage_has<'life0, 'async_trait>(
        &'life0 self,
        cache_name: String
    ) -> Pin<Box<dyn Future<Output = Result<bool, AnyError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn storage_delete<'life0, 'async_trait>(
        &'life0 self,
        cache_name: String
    ) -> Pin<Box<dyn Future<Output = Result<bool, AnyError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn put<'life0, 'async_trait>(
        &'life0 self,
        request_response: CachePutRequest,
        resource: Option<Rc<dyn Resource>>
    ) -> Pin<Box<dyn Future<Output = Result<(), AnyError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn match<'life0, 'async_trait>(
        &'life0 self,
        request: CacheMatchRequest
    ) -> Pin<Box<dyn Future<Output = Result<Option<(CacheMatchResponseMeta, Option<Self::CacheMatchResourceType>)>, AnyError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        request: CacheDeleteRequest
    ) -> Pin<Box<dyn Future<Output = Result<bool, AnyError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Associated Types§

Required Methods§

source

fn storage_open<'life0, 'async_trait>( &'life0 self, cache_name: String ) -> Pin<Box<dyn Future<Output = Result<i64, AnyError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn storage_has<'life0, 'async_trait>( &'life0 self, cache_name: String ) -> Pin<Box<dyn Future<Output = Result<bool, AnyError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn storage_delete<'life0, 'async_trait>( &'life0 self, cache_name: String ) -> Pin<Box<dyn Future<Output = Result<bool, AnyError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn put<'life0, 'async_trait>( &'life0 self, request_response: CachePutRequest, resource: Option<Rc<dyn Resource>> ) -> Pin<Box<dyn Future<Output = Result<(), AnyError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Put a resource into the cache.

source

fn match<'life0, 'async_trait>( &'life0 self, request: CacheMatchRequest ) -> Pin<Box<dyn Future<Output = Result<Option<(CacheMatchResponseMeta, Option<Self::CacheMatchResourceType>)>, AnyError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn delete<'life0, 'async_trait>( &'life0 self, request: CacheDeleteRequest ) -> Pin<Box<dyn Future<Output = Result<bool, AnyError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Cache for SqliteBackedCache

§

type CacheMatchResourceType = CacheResponseResource