I have this method in a controller:
def article_info
if @article = Article.find_by_permalink(params[:permalink])
@title = @article.title
@description = @article.excerpt
@body = @article.body
else
render_404
end
end
I ultimately want to cache the results of Article.find_by_permalink
so that query isn't executed every time an article is accessed.
So, how do I go about caching that query? Can I be cached from within the controller?
CLARIFICATION: I'm looking to cache this for an indefinite amount of time (until I decide to expire it). I'll ultimately be using memcache to do this.