oxcache 0.1.3

A high-performance multi-level cache library for Rust with L1 (memory) and L2 (Redis) caching.
Documentation
[package]
name = "oxcache"
version = "0.1.3"
edition = "2021"
description = "A high-performance multi-level cache library for Rust with L1 (memory) and L2 (Redis) caching."
authors = ["Kirky.X"]
license = "MIT"
repository = "https://github.com/kirky-x/oxcache"
readme = "README.md"
keywords = ["cache", "redis", "memory", "async", "performance"]
categories = ["caching", "asynchronous", "database"]

[lib]
name = "oxcache"
path = "src/lib.rs"

# ============================================================================
# MAIN DEPENDENCIES
# ============================================================================
[dependencies]
# Internal macros
oxcache_macros = { path = "macros", version = "0.1.3", optional = true }

# Async Runtime
tokio = { version = "1.32", features = ["full"] }
async-trait = "0.1"
lazy_static = "1.4"
once_cell = "1.18"

# Utilities
uuid = { version = "1.0", features = ["v4"] }
secrecy = { version = "0.8", features = ["serde"] }

# Error Handling
thiserror = "1.0"
anyhow = "1.0"

# Logging
log = "0.4"

# Configuration
toml = { version = "0.8", optional = true }

# Tracing for logging and instrumentation
tracing = { version = "0.1", optional = true }

# ============================================================================
# L1 CACHE DEPENDENCIES (Memory Cache)
# ============================================================================
[dependencies.moka]
version = "0.12"
default-features = false
features = ["future"]
optional = true

# In-memory concurrent map for internal state
[dependencies.dashmap]
version = "6.0"
optional = true

# ============================================================================
# L2 CACHE DEPENDENCIES (Redis Distributed Cache)
# ============================================================================
[dependencies.redis]
version = "0.27"
default-features = false
features = ["aio", "tokio-comp", "cluster-async", "sentinel", "connection-manager", "script"]
optional = true

# ============================================================================
# SERIALIZATION & COMPRESSION
# ============================================================================
[dependencies.serde]
version = "1.0"
default-features = false
features = ["derive", "alloc"]
optional = true

[dependencies.serde_json]
version = "1.0"
optional = true

[dependencies.flate2]
version = "1.0"
optional = true

[dependencies.bincode]
version = "1.3"
optional = true

# ============================================================================
# DATABASE DEPENDENCIES
# ============================================================================
[dependencies.sea-orm]
version = "1.0.14"
default-features = false
features = ["sqlx-sqlite", "runtime-tokio-rustls", "macros"]
optional = true

[dependencies.sqlx]
version = "0.8"
default-features = false
features = ["sqlite", "runtime-tokio-rustls", "macros", "migrate"]
optional = true

# ============================================================================
# OBSERVABILITY & METRICS
# ============================================================================

[dependencies.opentelemetry]
version = "0.22"
optional = true

[dependencies.opentelemetry_sdk]
version = "0.22"
optional = true

[dependencies.tracing-opentelemetry]
version = "0.23"
optional = true

[dependencies.opentelemetry-otlp]
version = "0.15"
optional = true

[dependencies.tracing-subscriber]
version = "0.3"
default-features = false
features = ["env-filter", "fmt"]
optional = true

# ============================================================================
# UTILITIES
# ============================================================================
[dependencies.tokio-util]
version = "0.7"
optional = true

[dependencies.futures]
version = "0.3"
optional = true

[dependencies.regex]
version = "1.10"
optional = true

[dependencies.chrono]
version = "0.4"
default-features = false
features = ["serde", "clock"]
optional = true

# ============================================================================
# ADVANCED FEATURES
# ============================================================================
# Bloom filter for cache optimization
[dependencies.bloomfilter]
version = "2.0.0"
optional = true

# Rate limiting
[dependencies.governor]
version = "0.6"
default-features = false
features = ["std"]
optional = true

# WAL (Write-Ahead Log) persistence
[dependencies.crc32fast]
version = "1.3"
optional = true

# Memory profiling support
[dependencies.jemalloc-ctl]
version = "0.5"
optional = true

# Murmur3 hash for bloom filters
[dependencies.murmur3]
version = "0.5"
optional = true

# ============================================================================
# CLI & CONFIGURATION
# ============================================================================
[dependencies.clap]
version = "4.4"
default-features = false
features = ["derive"]
optional = true

[dependencies.confers]
version = "0.1.1"
optional = true

# ============================================================================
# MCP & INTEGRATION
# ============================================================================
[dependencies.mcp-sdk-rs]
version = "0.3.4"
optional = true

# ============================================================================
# DEV DEPENDENCIES
# ============================================================================
[dev-dependencies]
tempfile = "3.8"
serial_test = "3.0"
rand = "0.8"
criterion = { version = "0.5", features = ["async_tokio"] }
ctor = "0.2"
mockall = "0.14.0"

# ============================================================================
# BUILD DEPENDENCIES
# ============================================================================
[build-dependencies]
anyhow = { version = "1.0", optional = true }


# ============================================================================
# FEATURE DEFINITIONS
# ============================================================================

[features]

# Default: Full feature set for maximum compatibility
default = ["full"]

skip_broken = []
test = []

# --------------------------------------------------------------------
# TIERED FEATURES (Build on top of individual features)
# --------------------------------------------------------------------

# Minimal: Only L1 memory cache - no Redis, no external services
minimal = [
    "l1-moka",
    "tokio/time",
    "dep:tracing",
    "metrics",
    "serialization",
    "chrono",
]

# Core: L1 + L2 basic functionality (Redis)
core = [
    "minimal",
    "l2-redis",
    "futures",
]

# Full: All features enabled
full = [
    "core",
    "macros",
    "bloom-filter",
    "rate-limiting",
    "wal-recovery",
    "database",
    "cli",
    "full-metrics",
    "batch-write",
    "config-toml",
    "confers",
    "codegen",
    "compression",
    "memory-profiling",
    "mcp-integration",
]

# --------------------------------------------------------------------
# COMPONENT FEATURES
# --------------------------------------------------------------------

# Cache Macros
macros = ["dep:oxcache_macros"]

# L1 Cache Implementation (Moka)
l1-moka = ["dep:moka", "dep:dashmap"]

# L2 Cache Implementation (Redis)
l2-redis = ["dep:redis"]

# Serialization Support
serialization = ["dep:serde", "dep:serde_json"]
bincode = ["serialization", "dep:bincode"]
compression = ["dep:flate2"]
flate2 = ["dep:flate2"]

# Metrics & Observability
opentelemetry = ["dep:opentelemetry", "dep:opentelemetry_sdk", "dep:tracing-subscriber"]
metrics = ["opentelemetry", "dep:dashmap"]
full-metrics = ["metrics", "dep:tracing-opentelemetry", "dep:opentelemetry-otlp"]

# Database Integration
database = ["dep:sea-orm", "dep:sqlx", "dep:regex"]

# Advanced Features
bloom-filter = ["dep:bloomfilter", "dep:murmur3"]
rate-limiting = ["dep:governor"]
wal-recovery = ["dep:crc32fast"]
batch-write = ["dep:tokio-util"]
sync = []
cli = ["dep:clap", "dep:dashmap", "dep:tracing", "metrics"]
config-toml = ["dep:toml"]
codegen = ["dep:anyhow"] # Used for build scripts
memory-profiling = ["dep:jemalloc-ctl"]
mcp-integration = ["dep:mcp-sdk-rs"]