Skip to main content

Crate hitbox_core

Crate hitbox_core 

Source
Expand description

§hitbox-core

Core traits and types for the Hitbox asynchronous caching framework.

This crate provides the foundational abstractions that make Hitbox protocol-agnostic and extensible. It defines the core traits that protocol-specific implementations (like hitbox-http) and backend implementations (like hitbox-redis, hitbox-moka) must implement.

§Architecture

Hitbox is built around a Finite State Machine (FSM) that orchestrates cache operations. This crate provides the traits that the FSM uses to:

§Feature Flags

  • rkyv_format - Enable rkyv zero-copy serialization support

Re-exports§

pub use cacheable::Cacheable;
pub use context::BoxContext;
pub use context::CacheContext;
pub use context::CacheStatus;
pub use context::CacheStatusExt;
pub use context::Context;
pub use context::ReadMode;
pub use context::ResponseSource;
pub use context::finalize_context;
pub use extractor::Extractor;
pub use key::CacheKey;
pub use key::KeyPart;
pub use key::KeyParts;
pub use label::BackendLabel;
pub use offload::DisabledOffload;
pub use offload::Offload;
pub use policy::CachePolicy;
pub use policy::EntityPolicyConfig;
pub use predicate::And;
pub use predicate::Neutral;
pub use predicate::Not;
pub use predicate::Or;
pub use predicate::Predicate;
pub use predicate::PredicateExt;
pub use predicate::PredicateResult;
pub use request::CacheablePolicyData;
pub use request::CacheableRequest;
pub use request::RequestCachePolicy;
pub use response::CacheState;
pub use response::CacheableResponse;
pub use response::ResponseCachePolicy;
pub use upstream::Upstream;
pub use value::CacheValue;

Modules§

cacheable
Serialization trait for cached values.
context
Cache context types for tracking cache operation results.
extractor
Cache key extraction from requests.
key
Cache key types and construction.
label
Backend label type for identifying cache backends.
offload
Offload trait for background task execution.
policy
Cache policy types and configuration.
predicate
Caching decision predicates.
request
Cacheable request types and traits.
response
Cacheable response types and traits.
upstream
Upstream service abstraction.
value
Cached value types with expiration metadata.

Type Aliases§

Raw
Raw byte data type used for serialized cache values. Using Bytes provides efficient zero-copy cloning via reference counting.