Skip to main content

larust_cache/
lib.rs

1//! A single cache, keyed by string, values serialized as JSON - backed by
2//! SQL-family storage (`Config::cache_driver == "database"`, the default)
3//! or Redis (`"redis"`), chosen at each call by [`store`]'s own dispatch.
4//! See [`sql_store`]/[`redis_store`] for the two implementations, and
5//! `store.rs`'s own doc comment for the dispatch shape.
6//!
7//! Deliberately ships no in-memory driver - mirroring
8//! `larust_http::session`'s own "no in-memory option in the public API"
9//! stance (an in-memory cache is the same trap: it "works" in every manual
10//! test, then silently starts missing on every deploy/restart). Laravel's
11//! own default (`CACHE_STORE=database` since Laravel 11) points the same
12//! direction - the `"redis"` option here mirrors Laravel's other common
13//! production choice, not an in-memory one.
14
15mod redis_store;
16mod sql_store;
17mod store;
18
19pub use store::{forget, get, put, remember, sweep_expired};