Files
my-website-v2/backend/public/src/state.rs

18 lines
402 B
Rust

use sqlx::PgPool;
pub type AppState = std::sync::Arc<tokio::sync::Mutex<AppInternalState>>;
pub struct AppInternalState {
pub database: sqlx::postgres::PgPool,
pub cache: cache::Cache,
}
impl AppInternalState {
pub fn new(database: PgPool, cache: cache::Pool) -> Self {
AppInternalState {
database,
cache: cache::Cache { inmem: cache },
}
}
}