Page Caching Outcome We implemented this by adding the actionpack-page_caching gem to the application. This type of caching creates a copy of the rendered page, which can be served instead of processing the template on each request by configuring the web server to do so.

This approach doesn’t work with pages that need authentication, nor pages that use Split, because the first treatment that a user receives, will be displayed for all the subsequent users.

Proposals

Option 1 - Action Caching A refactor can be done to query the treatment in a non cached action, forcing the decision logic to run on each request (in our case, the index action), while caching the other actions that display the result of the treatments.

Additional Details This was implemented by adding actionpack-action_caching to the gem file. This type of caching allows caching an action in the controller, in our case we cached the index action.

This provides simple logic to show a message based on the treatment given to the user.

When the application was run, it loaded and called the SDK just once, then started showing the cached action.

Similarly, a refactor can be done caching only fragments of the code that won’t change despite the obtained treatment.

Additional Details This caching is included in Rails and allows to cache a fragment of a page. We updated the previous view to show a cached fragment along with a non cached one, that’s recreated on each request.