2025-03-15 17:27:32 -04:00
|
|
|
use sqlx::PgPool;
|
|
|
|
|
|
|
|
pub type AppState = std::sync::Arc<tokio::sync::Mutex<AppInternalState>>;
|
|
|
|
|
|
|
|
pub struct AppInternalState {
|
|
|
|
pub database: sqlx::postgres::PgPool,
|
2025-07-14 20:26:17 -04:00
|
|
|
pub cache: cache::Cache,
|
2025-03-15 17:27:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
impl AppInternalState {
|
2025-07-14 20:26:17 -04:00
|
|
|
pub fn new(database: PgPool, cache: cache::Pool) -> Self {
|
2025-03-15 17:27:32 -04:00
|
|
|
AppInternalState {
|
|
|
|
database,
|
2025-07-14 20:26:17 -04:00
|
|
|
cache: cache::Cache { inmem: cache },
|
2025-06-29 23:41:20 -04:00
|
|
|
}
|
2025-03-15 17:27:32 -04:00
|
|
|
}
|
|
|
|
}
|