Damien Del Russo
Damien Del Russo

Reputation: 1048

How to Save A Tiny Bit Of Data In Rails On Heroku

I have a super simple Ruby on Rails app that doesn't have any ActiveRecord code. The app saves literally one line of text via a "record" URL. I want to be able to then hit a URL that feeds back whatever line of text was recorded. Like this:

Person 1: POST to www.myUrl.heroku.com/recorder, DATA = "A really interesting string"

Person 2: GET to www.myUrl.heroku.com/recorder, I want my response to contain "A really interesting string"

This sounds SUPER SIMPLE which is why I am mega-frustrated that I can't do it. Heroku has an ephemeral file system - I read all about that. And Heroku logs can't be accessed from within the app (as far as I can tell) - I can use command line tools but that doesn't help. But I only need the data there for 10 minutes!

Here are the things we tried so far:

I really don't want to sign up for AWS since this is a service for someone else, and it seems ridiculous to sign up for 1 tb of data transfer for literally 1 line of text (it overwrites anytime someone "records"). I also would prefer not to create a whole ActiveRecord deal given, again, literally 1 line of text.

Any ideas here? Is there some micro cache or whatever I can use? I only need the data to persist for about 10 minutes.

Thanks!

Damien

PS Using Ruby 2.0, rails 3.something.

Upvotes: 1

Views: 109

Answers (1)

nightCoder
nightCoder

Reputation: 36

You can take advantage of Rails application caching - rails.cache.write('key','value') and rails.cache.read('key')

Upvotes: 2

Related Questions