I would like to cache all pages in Controller_website
for that i need to get the final response, I tried to put a event class at final response so that i can cache it, cache check will done at before(), so that it will serve from cache before php to compile. how i do get final response in event handler?
You can't do that there, a controller never has a full view on everything that happens. Not unless you completely redesign your app and use a single front controller. And a before() doesn't have return value, so you can't return a cached page.
In the default setup, the only place to do it is in your index.php. It has full visibility of the response.
What you could do is have your controller throw a specific Exception when a cached page needs to be returned, and store the cache key in the exception message. In your index.php you catch that exception (like 404 and 500 are caught), fetch the cached page, and echo it out. If the exception does not happen, you will end up with a new response object (for the generated page), which you can then cache prior to echo.