bastos / jruby-memcache-client forked from ikai/jruby-memcache-client
- Source
- Commits
- Network (10)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
Bastos (author)
Thu Jan 22 14:12:31 -0800 2009
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
MIT-LICENSE | ||
| |
README | ||
| |
Rakefile | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
properties/ | ||
| |
spec/ | ||
| |
uninstall.rb |
README
This project is a FORK of the Ikai Lan project: http://github.com/ikai/jruby-memcache-client/tree This project is a JRuby wrapper of the Java MemCache library by Greg Whalin http://www.whalin.com/memcached/ The motivation for me to work on this wrapper comes from the fact that in production, the standard Ruby MemCache client can cause a thread to hang. In the Glassfish application server, by default there are 5 Grizzly connectors that handle incoming requests. A site that uses MemCache heavily can quickly cause all Grizzly connectors to block and take down a site. I'm hoping that this work I am doing here will help others adopt JRuby as a production platform for their Ruby on Rails applications. The Ruby MemCache library was never written with threaded applications in mind. All threads use the same socket, and multithreaded mode basically wraps the IO with a Mutex. The Java library provides several features that are not available in the Ruby MemCache library: - connection pooling - socket timeouts. In forks of the Ruby MemCache library this is achieved either with a Mongrel timeout or use of the Ruby Timeout class, which, at least at the writing of this README, will work unpredictably when being used as a failsafe against hanging IO. As of right now this code only provides a very minimal amount of functionality, but it is enough to use with the Rails cache and cache_fu. To use this code, copy the files in lib/* to the Rails lib/ directory. Add these lines of code to production.rb: memcache_options = { :namespace => 'fortaleza:production_live:', } memcached_servers = [ ENV['MEMCACHED_LOCATION'] || '0.0.0.0:11211'] # Constant used by libs CACHE = JMemCache.new memcached_servers, memcache_options if RUBY_PLATFORM =~ /java/ You can download diffenrent versions of the memcached .jar file here -------------------------------------------------------------------- http://www.whalin.com/memcached/#download I have not tested this in production yet. Dependencies if you want to use the log4j .jar file ---------------------------------------------------- You can download log4j here: http://logging.apache.org/log4j/1.2/download.html After building log4j, you'll want to put it in your classpath. While developing, it usually makes sense to have some verbose logging to STDOUT. You can accomplish this by placing creating a file called log4j.properties in your CLASSPATH or your RAILS_ROOT/lib directory. There is an example of this file in the properties directory of this project.

