On News Website, I have an Article model, and I want to cache the latest articles since I expect they have the highest hits. How can I write a method that operates in this way:
public function findById($id)
{
if(Article::inMemory($id))
return Article::findFromMemory($id);
return Article::find($id);
}
If there are any better approaches, please mention them as well