clache 0.2.0

Small utilities for caching data
Documentation
//! Lightweight, path-based caching utilities for various use cases.
//!
//! Clache provides two mechanisms for caching:
//!
//! - The [`GlobalCache`] requires less boilerplate and can operate on dynamic types. It is more
//!   suitable for an asset system, for example.
//! - [`LocalCache`]s are less flexible, but more efficient. Unlike the [`GlobalCache`], they
//!   store static types and are more suitable when paths are not linked to the filesystem, as a
//!   single path can be distinctly cached for different instances and types.
//!
//! ## Choosing a cache
//!
//! Use a [`LocalCache`] when:
//! - Are only caching one, known type.
//! - Are making a subsystem or the cache belongs to an object.
//! - And want more performance.
//!
//! Use the [`GlobalCache`] when:
//! - You want easy shared access.
//! - Are caching multiple/dynamic types.
//! - Or paths are uniquely identifying.
//!
//! ## Multi-threading and async support
//!
//! Both types of caches are thread-safe and async-safe. Almost every function has a blocking and
//! async variant, with the exception of [`uncache`] and [`clear`].
//!
//! [`RwLock`]: std::sync::RwLock
//! [`Arc`]: std::sync::Arc
//! [`LocalCache`]: crate::LocalCache
//! [`GlobalCache`]: crate::GlobalCache
//! [`get_or_else_async`]: crate::GlobalCache::get_or_else_async
//! [`uncache`]: crate::GlobalCache::uncache
//! [`clear`]: crate::GlobalCache::clear

mod fused_rw;

pub mod global_cache;
pub use global_cache::GlobalCache;

pub mod local_cache;
pub use local_cache::LocalCache;

#[doc(hidden)]
pub mod prelude {
    pub use crate::GlobalCache;
    pub use crate::LocalCache;
}