Introduction
This little trick comes from the frustration of forgetting the language code in the cache key, inside the Cache helper of Laravel.
Suppose that in a multilingual blog you are visiting the home page for the first time, using the default language (e.g. English). If the website caches the posts to speed up the response, maybe using the following code
<?php
$posts = Cache::rememberForever('posts', function() {
return DB::table('posts')->where( …