Redis and Rails sitting on the Couch

I’ve been spending some quality time with two of my new favorite tools lately (CouchDB and Redis, duh!), and while integrating them into Scalarium some needs and as a result some smaller hacks emerged. I don’t want to deprive the world of their joy, so here they are.

Making TextMate And rvm Play Nice

After being annoyed with running multiple versions of Ruby just by using MacPorts I finally gave in and tried out rvm, the Ruby Version Manager. That stuff got even more annoying when I tried to make Bundler behave well with multiple Ruby versions, because it just doesn’t by default. It’s not really a problem with normal gems, but Bundler falls apart with its defaults when you’re trying to run gems with native extensions. Hint: Set bundle_path to include RUBY_VERSION and make some links from one cache directory to another to not have every gem cached for every Ruby version.

How To Redis

We’ve covered some good ground already, some blabber about Redis in general, and also some thoughts on when using it could be beneficial. The other big question is: How do I integrate that stuff in my application? How do I get my objects to be stored neatly in Redis?

When To Redis

A very valid question is: What’s a good use case for Redis? There’s quite a few, as Redis isn’t your every day key-value store, it allows you to keeps lists and sets in your datastore, and to run atomic operations on them, like pushing and popping elements. All that stuff is incredibly fast, as obviously your data is held in memory and only persisted to the hard disk if necessary and to top it off, asynchronously, while not reducing the throughput of the server itself.

There’s Something About Redis

I like to think that there’s never been a more exciting time when it comes to playing with new technologies. Sure, that’s a bit selfish, but that’s just how I feel. Doing Java after I got my diploma was interesting, but it wasn’t exciting. Definitely not compared to the tools that keep popping up everywhere.