Cache refactor - add an in-memory cache, so redis is not needed

This commit is contained in:
Zsombor Gegesy 2023-09-09 18:17:29 +02:00
parent d1d2d4e44d
commit 996ff84c5b
10 changed files with 263 additions and 146 deletions

View file

@ -9,7 +9,12 @@ fn spawn_app() -> String {
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
let port = listener.local_addr().unwrap().port();
let config = Config::parse(false).unwrap();
let server = run(listener, config).expect("Failed to bind address");
let server = run(
listener,
config,
websurfx::cache::cacher::Cache::new_in_memory(),
)
.expect("Failed to bind address");
tokio::spawn(server);
format!("http://127.0.0.1:{}/", port)