BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Rails Caching Reloaded With EHCache

Rails Caching Reloaded With EHCache

This item in japanese

Rails 2.1 brings new caching features which makes it very easy to cache any values including models. Apart from the basic File, Memory and DRb stores, Memcached was the only solution to do shared memory cache. (J)RoR can now count on the popular Java distributed cache EHCache as part of its new Cache stores thanks to Dylan Stamat.

In the JEE world, debates around using EHCache vs. Memcached for second level cache have long been raging. While Memcached is popular in the LAMP and RoR world (Linkedin.com will switch to it soon), EHCache was adopted by projects like Spring or Hibernate. In an effort to migrate an existing application from MRI Ruby to JRuby, Dylan Stamat ported EHCache to JRuby adding EhcacheStore as a new cache Store.
In the MRI world, we use memcached, which is a Ruby interface to the libmemcached C client. It is one of the only Ruby libraries that currently supports consistent hashing, which is a requirement for our production environment. When preparing for JRuby, we had a different set of options. One was writing our own hooks into libmemcached via JNA, JRuby FFI, etc. The other was to look for another cache solution in Java, and Ehcache was definitely on top of the list.
Would you consider using EHcache with JRuby?

Rate this Article

Adoption
Style

Educational Content

BT