use( "/cached", CacheMiddleware::withHeaders( type: "public", mustRevalidate: true, maxAge: 3600, strictEtag: true ) ); $app->get("/cached/greet", function ($c) { sleep(5); return $c->json([ "message" => "Welcome cached route!", ]); }); $app->get("/uncached/greet", function ($c) { sleep(5); return $c->json([ "message" => "Uncached route!", ]); }); $app->run();