Crate light_cache
source ·Expand description
A simple, fast and concurrent cache designed for async rust.
§Quick Start
The easiest way to get started with LightCache is to use crate::RefreshCache
§Policy Implementers
LightCache is designed to be flexible and allow for custom policies to be implemented.
If you want to implement your own policy, you should implement the crate::Policy trait.
And you must use the cache::NoPolicy in your implementation to access the policy free cache methods.
Using LightCache::get or any other method that doesnt end in _no_policy will cause cause an infinite loop.
Another thing to possibly note is that any task using async insertion methods (LightCache::get_or_insert, LightCache::get_or_try_insert, etc)
will always first call Policy::get but only the task that actually inserts the value will call Policy::insert.
Modules§
- The underlying map used by LightCache. Desinged to be fast and non-blocking for connurrent r/w.
- A policy augments access to a LightCache instance, managing the entry and eviction of items in the cache.
- A RefreshCache provides a simple interface for caching values with a time-to-live policy.
Structs§
- A concurrent hashmap that allows for efficient async insertion of values
- A concurrent hashmap implementation thats always non-blocking.
- A
RefreshCacheprovides a simple interface for caching values with a time-to-live policy for any type that maps a key to a value asynchronously
Traits§
- A Policy augments accsess to a LightCache instance, managing the entry and eviction of items in the cache.