gcache 0.0.1

A cache group to accurate remote data access
Documentation
pub mod file;

use std::future::Future;

use tokio::io::AsyncRead;

pub trait CacheStore<K: ?Sized>: Send + Sync {
    type Err: Send;
    type Reader: AsyncRead + Unpin + Send;
    fn fill<R>(&self, k: &K, v: &mut R) -> impl Send + Future<Output = Result<(), Self::Err>>
    where
        R: AsyncRead + Unpin + Send;
    fn get_reader<Q: ?Sized + Sync + AsRef<K>>(
        &self,
        k: &Q,
        offset: u64,
        limit: u64,
    ) -> impl Send + Future<Output = Result<Option<Self::Reader>, Self::Err>>;
    fn evict<Q: ?Sized + Sync + AsRef<K>>(
        &self,
        k: &Q,
    ) -> impl Send + Future<Output = Result<(), Self::Err>>;
}