A library for using Memcached as a second level distributed cache in Hibernate.
- Based on the excellent spymemcached client
- Includes support for the Whalin (danga) memcached client
- Supports entity and query caching.
If you have any questions, or just want to drop a line to say it's working great :) use the google-group.
Please note that this is an open source project. I work on it when I can and I implement what I feel like. I am volunteering my own free time for my own amusement.
- Compatible with hibernate 4.3.6.
- Updated version of SpyMemcache client.
- Compatible with hibernate 4.2.0.
-
Compatible with hibernate 4.
-
Example config:
<property name="hibernate.cache.region.factory_class">com.googlecode.hibernate.memcached.MemcachedRegionFactory</property>
<property name="hibernate.memcached.operationTimeout">5000</property>
<property name="hibernate.memcached.connectionFactory">KetamaConnectionFactory</property>
<property name="hibernate.memcached.hashAlgorithm">HashAlgorithm.FNV1_64_HASH</property>
- HashCodeKeyStrategy StringKeyStrategy are now both deprecated.
- Sha1KeyStrategy is now the default strategy.
- Md5KeyStrategy and Sha1KeyStrategy both digest the entire combined key now (region, clear index, key)
- Md5KeyStrategy and Sha1KeyStrategy have been re-implemented to hash both the toString() and hashCode() values of the Hibernate query key object. This should eliminate collisions when using hashCode() alone. Issue 22.
- HashCodeKeyStrategy StringKeyStrategy will throw exceptions now if the key length is greater than 250.
As a result of these changes hibernate-memcached will miss on all cache requests upon upgrading to this version. This is due to the switch to Sha1KeyStrategy as the default. Hibernate-memcached will now generate different keys for the same data you were caching previously. Essentially, your cache will appear empty to Hibernate.
Also, as a result of these changes, 1.3 may not be binary compatible with any subclass hacks you may have written that extend HashCodeKeyStrategy, StringKeyStrategy, Md5KeyStrategy, or Sha1KeyStrategy. Note that the KeyStrategy interface and AbstractKeyStrategy have not changed at all. If you implemented/extended those directly you're fine.
- Patch from @burtbeckwith to allow for memcached authentication via the spymemcached client. This can be specified using "hibernate.memcached.username" and "hibernate.memcached.password"
- Patch from ddlatham to allow the spymemcached library to be put into daemon mode. This is accomplished by setting hibernate.memcached.daemonMode to true.
- Updated the maven pom to pull in spymemcached 2.4.2 by default.
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with pom.xml, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send me a pull request. Bonus points for topic branches.