Cargo Features

[dependencies]
moka = { version = "0.12.8", default-features = false, features = ["sync", "future", "logging", "atomic64", "unstable-debug-counters", "quanta"] }
default = atomic64, quanta

These default features are set whenever moka is added without default-features = false somewhere in the dependency tree.

sync

Enable this feature to use moka::sync::{Cache, SegmentedCache}

Affects sync_base::PredicateId, moka::notification, moka::ops, moka::policy

future unstable-debug-counters? = async-lock, async-trait, event-listener, futures-util

Enable this feature to use moka::future::Cache.

Affects moka::notification, moka::ops, moka::policy

logging = log

Enable this feature to activate optional logging from caches.
Currently cache will emit log only when it encounters a panic in user provided callback closure.

atomic64 default

This feature is enabled by default. Disable it when the target platform does not support std::sync::atomic::AtomicU64. (e.g. armv5te-unknown-linux-musleabi or mips-unknown-linux-musl) https://github.com/moka-rs/moka#resolving-compile-errors-on-some-32-bit-platforms

unstable-debug-counters = future

This unstable feature adds GlobalDebugCounters::current function, which returns counters of internal object construction and destruction. It will have some performance impacts and is intended for debugging.

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

quanta default

Enables quanta

Optional dependencies (enabled by default)

async-lock future?

Enables async-lock

Optional dependencies (future)

async-trait future?
event-listener future?
futures-util future?
log logging?

Enables log

Optional dependencies (logging)