Company
Date Published
Author
John Zablocki, NET. SDK Developer, Couchbase
Word count
528
Language
English
Hacker News points
None

Summary

NHibernate, a popular object-relational mapping tool for .NET, has expanded its 2nd level caching capabilities to include Couchbase, leveraging its compatibility with Memcached, which was previously supported through the Enyim.Caching library. This integration, ported by the author to Couchbase, offers a plug-and-play solution demonstrated through a sample ASP.NET MVC project available on GitHub. The project showcases how to configure NHibernate using FluentNHibernate, which allows code-based configuration rather than XML files, and illustrates enabling caching on model classes, such as a beer class, by setting appropriate cache options. The Couchbase provider requires minimal configuration, but users must ensure that caching is managed correctly within ASP.NET applications to avoid cache recreation per request. The solution, part of Couchbase Labs and licensed under Apache License 2.0, is a fast and scalable caching option for NHibernate users, and it is also compatible with Membase. However, cache regions and expiration settings for entities or queries need to be defined separately.