light_cache/lib.rs
1//! A simple, fast and concurrent cache designed for async rust.
2//!
3//! # Quick Start
4//! The easiest way to get started with LightCache is to use [`crate::RefreshCache`]
5//!
6//! # Policy Implementers
7//! LightCache is designed to be flexible and allow for custom policies to be implemented.
8//! If you want to implement your own policy, you should implement the [`crate::Policy`] trait.
9//! And you must use the [`cache::NoPolicy`] trait in your implementation to access the policy free cache methods.
10//! Using [`LightCache::get`] or any other method that doesnt end in `_no_policy` will cause cause an infinite loop.
11//!
12//! Another thing to possibly note is that any task using async insertion methods ([`LightCache::get_or_insert`], [`LightCache::get_or_try_insert`], etc)
13//! will always first call [`Policy::get`] but only the task that actually inserts the value will call [`Policy::insert`].
14
15pub mod cache;
16#[doc(inline)]
17pub use cache::LightCache;
18
19/// The underlying map used by LightCache. Desinged to be fast and non-blocking for conncurrent r/w.
20pub mod map;
21#[doc(inline)]
22pub use map::LightMap;
23
24/// A policy augments access to a LightCache instance, managing the entry and eviction of items in the cache.
25pub mod policy;
26#[doc(inline)]
27pub use policy::Policy;
28
29/// A RefreshCache provides a simple interface for caching values with a time-to-live policy.
30pub mod refresh;
31#[doc(inline)]
32pub use refresh::RefreshCache;
33
34#[doc(hidden)] pub mod constants_for_benchmarking;