Trait opendal::layers::CachePolicy
source · pub trait CachePolicy: Send + Sync + Debug + 'static {
fn on_create(
&self,
inner: Arc<dyn Accessor>,
cache: Arc<dyn Accessor>,
path: &str,
args: OpCreate
) -> BoxFuture<'static, Result<RpCreate>> { ... }
fn on_read(
&self,
inner: Arc<dyn Accessor>,
cache: Arc<dyn Accessor>,
path: &str,
args: OpRead
) -> BoxFuture<'static, Result<(RpRead, BytesReader)>> { ... }
fn on_write(
&self,
inner: Arc<dyn Accessor>,
cache: Arc<dyn Accessor>,
path: &str,
args: OpWrite,
r: BytesReader
) -> BoxFuture<'static, Result<RpWrite>> { ... }
fn on_delete(
&self,
inner: Arc<dyn Accessor>,
cache: Arc<dyn Accessor>,
path: &str,
args: OpDelete
) -> BoxFuture<'static, Result<RpDelete>> { ... }
}
Expand description
CachePolicy allows user to specify the policy while caching.
Provided Methods§
sourcefn on_create(
&self,
inner: Arc<dyn Accessor>,
cache: Arc<dyn Accessor>,
path: &str,
args: OpCreate
) -> BoxFuture<'static, Result<RpCreate>>
fn on_create(
&self,
inner: Arc<dyn Accessor>,
cache: Arc<dyn Accessor>,
path: &str,
args: OpCreate
) -> BoxFuture<'static, Result<RpCreate>>
on_create returns the cache policy on create operation.
sourcefn on_read(
&self,
inner: Arc<dyn Accessor>,
cache: Arc<dyn Accessor>,
path: &str,
args: OpRead
) -> BoxFuture<'static, Result<(RpRead, BytesReader)>>
fn on_read(
&self,
inner: Arc<dyn Accessor>,
cache: Arc<dyn Accessor>,
path: &str,
args: OpRead
) -> BoxFuture<'static, Result<(RpRead, BytesReader)>>
on_read returns the cache policy on read operation.