Struct opendal::layers::MetadataCacheLayer
source · pub struct MetadataCacheLayer { /* private fields */ }
Expand description
MetadataCacheLayer will add metadata cache support for OpenDAL.
Notes
This layer only maintains its own states. Users should care about the cache consistency by themselves. For example, in the following situations, users could get out-dated metadata cache:
- Users have operations on underlying operator directly.
- Other nodes have operations on underlying storage directly.
- Concurrent read/write/delete on the same path.
To make sure metadata cache consistent across the cluster, please make sure all nodes in the cluster use the same cache services like redis or tikv.
Examples
use anyhow::Result;
use opendal::layers::MetadataCacheLayer;
use opendal::services::memory;
use opendal::Operator;
use opendal::Scheme;
let _ = Operator::from_env(Scheme::Fs)
.expect("must init")
.layer(MetadataCacheLayer::new(
memory::Builder::default().build().expect("must init"),
));
Implementations
Trait Implementations
sourceimpl Clone for MetadataCacheLayer
impl Clone for MetadataCacheLayer
sourcefn clone(&self) -> MetadataCacheLayer
fn clone(&self) -> MetadataCacheLayer
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for MetadataCacheLayer
impl Debug for MetadataCacheLayer
Auto Trait Implementations
impl !RefUnwindSafe for MetadataCacheLayer
impl Send for MetadataCacheLayer
impl Sync for MetadataCacheLayer
impl Unpin for MetadataCacheLayer
impl !UnwindSafe for MetadataCacheLayer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more