1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Store slow results, such as a report or an API response, and read them back on later requests.
//!
//! The cache keeps typed values in named stores, each backed by a driver: `memory`, `database`,
//! `redis`, `failover`, `discard`, or one you register with [`Drivers::extend`]. The functions in
//! this module use the default store, which `CACHE_STORE` names. To use another store, pick it by
//! name with [`store`]. [`lock`] gives you an atomic lock that every process using the store shares.
//!
//! ```no_run
//! # #[derive(serde::Serialize, serde::Deserialize)] struct User;
//! # #[derive(serde::Serialize, serde::Deserialize)] struct Report;
//! # async fn generate_report() -> laravel::Result<Report> { Ok(Report) }
//! use laravel::cache;
//! use laravel::time::ToSpan;
//!
//! # async fn example(user: User) -> laravel::Result<()> {
//! cache::put("user:42", &user, 5.minutes()).await?;
//! let user: Option<User> = cache::get("user:42").await?;
//!
//! let report: Report = cache::store("reports")?
//! .remember("monthly", 10.minutes(), || async { generate_report().await })
//! .await?;
//! # Ok(()) }
//! ```
//!
//! The cache manager creates each store on first use. A store connects to its backend only when
//! it first reads or writes a value, so an unreachable database never stops the application from
//! booting.
//!
//! To learn about configuration, locks, and testing, check out the
//! [cache guide](https://github.com/laravel/rust-framework/blob/0.x/docs/cache.md).
pub use *;
pub use ;
/// Define a migration's `migrate` function to create the `database` cache store's tables.
///
/// Put the macro alone in a migration file, and it creates the `cache` and `cache_locks` tables. To change the
/// tables, replace the macro with the migration the
/// [cache guide](https://github.com/laravel/rust-framework/blob/0.x/docs/cache.md#the-database-store) shows,
/// then edit it.
///
/// ```
/// // database/migrations/0001_01_01_000001_create_cache_table.rs
/// laravel::cache::tables!();
/// ```
pub use cache_tables as tables;
pub use CacheServiceProvider;
/// The factory for the database store, or `None` without the `database` feature.
pub const DATABASE_STORE: = ;