Sunday, 15 March 2015

How do i store a table with constants and cache it in rails? -


I have a table with constants that I would like to load at startup so that it can be used in my classes. In addition, I would like to refresh it after one hour if someone hits the webpage (1 hour cache)

I feel like I should start it with the rail cache around it . I'm not sure that the other methods of controller will be called after initialization.

Any recommendations on my approach? Thank you

I like to use the read-through caching mechanism for this. If you are referring to a mapped table for an ActiveRecord model, then check out shopping for the recent implementation of this idea relevant to railway 3.

No comments:

Post a Comment