Im working on the Statistics page on my site, and I need to keep the general session Variables to normal duration (ex: 120 min) But I also want to store some of my Variables so I wont have to do 8 SQL queries every page reload for example I want to save the user posts count for each of the past 30 days but its something that changes often so want to save it only for 10 minutes How can I make only specific Variables from the session to be removed after 10 minutes but keep the other alive?
I've thought about saving the last refresh time and every reload check if its been 10 minutes
Session::put('lastRefresh', Carbon::now()->timestamp);
In Cache I would just do it
Cache::put('posts', $posts, 10);
But its unique to each user so I can't And some times its just a big array (90 Items for 90 Days) So I can't use cookie :P
Just don't know if its the best or most efficient way to do so