Expand description
The Cache contract every driver implements.
The trait is deliberately dyn-compatible: the factory in crate::config
decides at boot which driver an application uses, so the rest of the
framework has to be able to hold an Arc<dyn Cache> without knowing which
one it got. That is why every method returns a BoxFuture instead of
being an async fn — async fn in a trait is not dyn-compatible.
The generic conveniences that cannot be dyn-compatible (remember, which
takes a closure returning a future) live in CacheExt, blanket-implemented
for every Cache including dyn Cache, so callers never notice the split.
Traits§
- Cache
- A cache backend.
- Cache
Ext - The conveniences that take a closure, and so cannot live on a dyn-compatible
trait. Blanket-implemented, including for
dyn Cache.
Type Aliases§
- BoxFuture
- A boxed future borrowed from the cache and its key arguments.