Sunday, December 07, 2008

Hibernate-memcached 1.1.0 Released!

After a bit of trial and error with the maven release plugin, the latest release of hibernate-memcached is available. This release includes a few new features:
  • Support for the Whalin memcached client
  • New Key strategies: Md5KeyStrategy, Sha1KeyStrategy for reducing the length of keys
  • Better Exception handling during cache failure scenarios

This is the first release after moving the source to github.

I need to do some wiki work to get documentation up for how to enable and configure the Whalin/Danga memcached client. I hope to get to that some time this week.

The new KeyStrategy implementations for Md5 and Sha1 are there to reduce the size of the keys. Raymond He emailed me to point out that the obnoxiously long keys that Hibernate generates take up a lot of memory in memcached. Many records + ~250 char keys = a lot of wasted space. The new Md5 and Sha1 keys strategies simply take the fully qualified key name generated by hibernate-memcached and hash them up to take a lot less space.

The improved exception handling revolves around the addition of a new MemcachedExceptionHandler interface and a default LoggingMemcacheExceptionHandler implementation. Essentially the Spy and Danga memcached clients are wrapped up to eat any exception that comes out of them. There's really no reason for the cache layer to throw exceptions at Hibernate. Errors are logged as Errors, and a null is returned.



Anonymous said...

Hey Ray, love your code, we're using it production! Any chance you could post quick instructions on getting the Whalin provider working?

Cheers, Nick.

Ray Krueger said...

Thanks for the kind words Nick. I still need to do a wiki page on the Danga/Whalin client; but I've been busy :P

The first thing is to set...

From there you can derive the other props by looking at

Anonymous said...

Maybe you can read this:

none said...


Hibernate-memcached sounds like a great combination. We are using JBoss+Hibernate as the JPA provider for a new project that will be deployed in a cluster and will need a distributed cache system.

Do you have any knowledge of the biggest production deployments of hibernate-memcached that you can share?

I want to throw this as an option to my management (pushing open source love on them ;), but you know this is the first question they will ask (is it a proven tried-and-tested technology) ;)

-Nikolay from San Jose, CA

Ray Krueger said...

Off the top of my head I don't know where/how hibernate-memcached is being used.

Do some googling/reading on memcached and where it's being used and I think your management will be immediately wowed.

As for hibernate-memcached, which is just my bridge between the two, I don't know where/how it's being used in the wild really. Your best bet would be to ask on the hibernate-memcached group and see how folks are using it...

Ray Krueger said...

Apparently blogger doesn't automatically make links...

Hibernate-memcached Google Group