I am new to Rails and I am building a rails server which acts as the
backend for a mobile app. I have certain daemon processes that fetch and
store data in a database. Every time someone makes a request for data
from the phone, I will have to send him the same dataset irrespective of
who is requesting the data.
This dataset will keep changing quite frequently and my daemons will
keep updating the database accordingly. Since the same data is to be
sent to every one, I am assuming that it would be best to cache the data
on the server and keep updating the cache at a set frequency (thus
making only one trip to the db). When I get a request from the phone, I
just retrieve this cached dataset and send it back, w/o hitting the db.
I think one way of doing this would be to use a singleton model class
which will cache the data and this would act as the source. Is this the
best way to go about this process? Does Rails provide some other means
of doing this?