[go: up one dir, main page]

moka 0.11.3

A fast and concurrent cache library inspired by Java Caffeine
Documentation
[package]
name = "moka"
version = "0.11.3"
edition = "2018"
# Rust 1.65 was released on Nov 3, 2022.
rust-version = "1.65"
description = "A fast and concurrent cache library inspired by Java Caffeine"
license = "MIT OR Apache-2.0"
# homepage = "https://"
documentation = "https://docs.rs/moka/"
repository = "https://github.com/moka-rs/moka"
keywords = ["cache", "concurrent"]
categories = ["caching", "concurrency"]
readme = "README.md"
exclude = [".circleci", ".devcontainer", ".github", ".gitpod.yml", ".vscode"]
build = "build.rs"

[features]
default = ["sync", "atomic64", "quanta"]

# This feature is enabled by default. Disable it when you do not need
# `moka::sync::{Cache, SegmentedCache}`
sync = ["_core"]

# Enable this feature to use `moka::future::Cache`.
future = ["_core", "async-io", "async-lock", "futures-util"]

# 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.
logging = ["log"]

# 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
atomic64 = []

# This is an **experimental** feature to make `unsync` and `sync` caches to compile
# for `wasm32-unknown-unknown` target. Note that we have not tested if these caches
# work correctly in wasm32 environment.
js = ["uuid/js"]

# 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 purpose.
unstable-debug-counters = ["future"]

# A feature used internally.
_core = [
    "crossbeam-channel",
    "crossbeam-epoch",
    "crossbeam-utils",
    "once_cell",
    "parking_lot",
    "scheduled-thread-pool",
    "smallvec",
    "tagptr",
    "thiserror",
    "triomphe",
    "uuid",
]

[dependencies]

# The "_core" dependencies used by "sync" and "future" features.
crossbeam-channel = { version = "0.5.5", optional = true }
crossbeam-utils = { version = "0.8", optional = true }
once_cell = { version = "1.7", optional = true }
parking_lot = { version = "0.12", optional = true }
scheduled-thread-pool = { version = "0.2.7", optional = true }
smallvec = { version = "1.8", optional = true }
tagptr = { version = "0.2", optional = true }

# Opt-out serde and stable_deref_trait features
# https://github.com/Manishearth/triomphe/pull/5
triomphe = { version = "0.1.3", default-features = false, optional = true }

# Optional dependencies (enabled by default)
crossbeam-epoch = { version = "0.9.9", optional = true }
quanta = { version = "0.11.0", optional = true }
thiserror = { version = "1.0", optional = true }
uuid = { version = "1.1", features = ["v4"], optional = true }

# Optional dependencies (future)
async-io = { version = "1.4", optional = true }
async-lock = { version = "2.4", optional = true }
futures-util = { version = "0.3", optional = true }

# Optional dependencies (logging)
log = { version = "0.4", optional = true }

[dev-dependencies]
actix-rt = { version = "2.7", default-features = false }
ahash = "0.8.3"
anyhow = "1.0.19"
async-std = { version = "1.11", features = ["attributes"] }
env_logger = "0.10.0"
getrandom = "0.2"
paste = "1.0.9"
reqwest = "0.11.11"
skeptic = "0.13"
tokio = { version = "1.19", features = ["fs", "macros", "rt-multi-thread", "sync", "time" ] }

[target.'cfg(trybuild)'.dev-dependencies]
trybuild = "1.0"

[target.'cfg(skeptic)'.build-dependencies]
skeptic = "0.13.5"

[target.'cfg(rustver)'.build-dependencies]
rustc_version = "0.4.0"

# https://docs.rs/about/metadata
[package.metadata.docs.rs]
# Build the doc with some features enabled.
features = ["future"]
rustdoc-args = ["--cfg", "docsrs"]

[[example]]
name = "async_example"
required-features = ["future"]

[[example]]
name = "sync_example"
required-features = ["sync"]

[[example]]
name = "eviction_listener"
required-features = ["sync"]

[[example]]
name = "size_aware_eviction"
required-features = ["sync"]