Wednesday, May 6, 2009

JRuby MemCache Client Gem

I wrote a post about using the jruby_memcache_client Rails plugin to manage sessions. Since then, Abhi Yerra made a fork of Ikai Lan's repository and turned it into a gem. I promptly merged his changes into my repository and I am now publishing my own version of the gem (with a few minor changes).

The new JRuby MemCache Client Gem is API compatible with the Ruby MemCache Client. You should now be able to install the gem into your application and use it directly.

Installing The Gem

You need to add github as a source for gems before you can install the new gem. Thsi is a simple one time command to run:

gem sources -a http://gems.github.com The next step is to install the gem as usual:
jruby -S gem install fredjean-jruby-memcache-client --remote Using the JRuby MemCache Client Gem One way to use the JRuby MemCache Client is to add the following to your environment.rb:
memcache_options = {
:namespace => 'fortaleza:production_live:'
}
memcached_servers = [ ENV['MEMCACHED_LOCATION'] || '127.0.0.1:11211']

# Constant used by libs
CACHE = MemCache.new memcached_servers, memcache_options

You will then be able to configure Rails to use the :mem_cache_store for both session and cache store.

Friday, May 1, 2009

Colorado Springs Introduction to JRuby Talk

@fredjean talking about JRuby on Twitpic I opened up the Colorado Springs Open Source User Group with a very quick introduction to JRuby. The talk was well received and there was a good back and forth with the audience. Many interesting questions were asked and there were a few follow up discussions. Ben Simo (@QualityFrog) had the following feedback on the presentation:

200905011139.jpg

This is pretty much what any presenter could hope for :)

Here are the slides: