cache2 0.6.0

Performance-first bounded RAM and NVMe hybrid cache
Documentation
// Copyright 2026 ScopeDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Bounded RAM + Region SSD cache.
//!
//! Mutations provide process-local visibility. An unclean restart opens empty;
//! [`Cache::close_warm`] publishes a recoverable image.
//! See [`Error`] for failure classifications and handling policy.

#[cfg(feature = "benchmarking")]
#[doc(hidden)]
pub mod benchmarking;

mod error;
pub use self::error::Error;
pub use self::error::ErrorKind;
pub use self::error::ErrorOperation;

mod cache;
pub use self::cache::Cache;
pub use self::cache::CacheTier;
pub use self::cache::Value;

mod config;
pub use self::config::CacheConfig;
pub use self::config::StorageLayout;
pub use self::config::runtime::FillControlOptions;
pub use self::config::runtime::FillLimits;
pub use self::config::runtime::IoEngineOptions;
pub use self::config::runtime::IoMode;
pub use self::config::runtime::IoUringOptions;
pub use self::config::runtime::IoUringPoolOptions;
pub use self::config::runtime::IoUringSqPollOptions;
pub use self::config::runtime::L1EvictionPolicy;
pub use self::config::runtime::PosixIoOptions;
pub use self::config::runtime::ReadAdmission;
pub use self::config::runtime::RuntimeOptions;
pub use self::config::storage::StorageOptions;

mod snapshot;
pub use self::snapshot::CacheHealth;
pub use self::snapshot::CacheIndexSnapshot;
pub use self::snapshot::CacheIoDirectionSnapshot;
pub use self::snapshot::CacheIoPathSnapshot;
pub use self::snapshot::CacheIoSnapshot;
pub use self::snapshot::CacheL1Snapshot;
pub use self::snapshot::CacheReclaimSnapshot;
pub use self::snapshot::CacheSnapshot;
pub use self::snapshot::DetailedCacheSnapshot;
pub use self::snapshot::FillControlSnapshot;
pub use self::snapshot::FillPressure;
pub use self::snapshot::RegionSnapshot;
pub use self::snapshot::StartupMode;

mod checksum;
mod codec;
mod hashing;
mod io;
mod managed_memory;
mod memory;
mod region;

#[cfg(test)]
mod fixtures;
#[cfg(test)]
mod property_tests;

mod stats;
pub use self::stats::CacheStatsSnapshot;
pub use self::stats::IoLatencySnapshot;
pub use self::stats::IoOutcome;
pub use self::stats::IoRole;
pub use self::stats::LATENCY_BUCKET_UPPER_BOUNDS_NS;
pub use self::stats::LatencyMode;
pub use self::stats::LatencySnapshot;
pub use self::stats::RequestLatencyScope;
pub use self::stats::RequestOperation;
pub use self::stats::RequestOutcome;
pub use self::stats::RequestStatsSnapshot;
pub use self::stats::StatsOptions;