Ruby on Rails – Cache function of a model in ActiveRecord model

Tram Ho

Hi everybody

This issue is actually a question for me, then I groped and handled it, so share here and discuss

Suppose I have model user.rb, function find (: id), I want to cache query of this function of a certain model, not all, how will it be handled

Here is my treatment

model: user.rb

services / rd.rb

$ rd is the redis client connection where config / application.rb

Everyone has any way or have any contribution, please comment, thank you

Share the news now

Source : Viblo