Cargo Features

moka = { version = "0.12.5", default-features = false, features = ["sync", "future", "logging", "atomic64", "js", "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.


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, 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)


This is an experimental feature to make sync caches to compile for wasm32-unknown-unknown target. Note that we have not tested if these caches work correctly in wasm32 environment.

Enables js of uuid

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.

quanta default

Enables quanta

Optional dependencies (enabled by default)

async-lock future?

Enables async-lock ^2.4

Optional dependencies (future)

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

Enables log

Optional dependencies (logging)