Store CopyCopter Results Locally

410 Views Asked by At

Following the Railscast episode on copycopter, so I set up my copycopter server on heroku. Everything works great, until AWS goes down and brings down heroku. At that moment, all my copycopter text reverted to the default text I had entered on my html pages.

Is there a way I can store the results from a successful call to my copycopter server on my rails server so that, in case of another heroku outage, my text will still be from copycopter?

1

There are 1 best solutions below

4
On BEST ANSWER

Could you use I18n cache by passing a cache store or even I18n memoization? In my Rails app, I have I18n::Backend::Simple.include(I18n::Backend::Memoize) in an initializer, so all the translations are cached in memory after the first hit. I18n also supports using a real cache store so you could use memcached or redis to store the copies which would avoid the issue you mentioned when copycopter server goes down.

From copycopter readme, you can also export the blurbs:

Blurbs are cached in-memory while your Rails application is running. To export all cached blurbs to a yml file for offline access, use the rake task:

rake copycopter:export

The exported yaml will be located at config/locales/copycopter.yml.