Expand description
Lightweight, path-based caching utilities for various use cases.
Clache provides two mechanisms for caching:
- The
GlobalCacherequires less boilerplate and can operate on dynamic types. It is more suitable for an asset system, for example. LocalCaches are less flexible, but more efficient. Unlike theGlobalCache, 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.
Re-exports§
pub use global_cache::GlobalCache;pub use local_cache::LocalCache;
Modules§
- global_
cache - Globally-accessible storage for performant, path-indexed caching.
- local_
cache - Strongly-typed local cache.