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 trait 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§

cache
map
The underlying map used by LightCache. Desinged to be fast and non-blocking for conncurrent r/w.
policy
A policy augments access to a LightCache instance, managing the entry and eviction of items in the cache.
refresh
A RefreshCache provides a simple interface for caching values with a time-to-live policy.

Structs§

LightCache
A concurrent hashmap that allows for efficient async insertion of values
LightMap
A concurrent hashmap implementation thats always non-blocking.
RefreshCache
A RefreshCache provides a simple interface for caching values with a time-to-live policy for any type that maps a key to a value asynchronously

Traits§

Policy
A Policy augments accsess to a LightCache instance, managing the entry and eviction of items in the cache.