How to make a controller's data global within a request context?

Here’s a nice article on how to pass around the data within a request using the request_store gem. This is specifically helpful when you want to access a controller’s data(params, cookies etc.) outside its context in discourse. The good thing is, this data lives only till the request.