Looks like Memcached ClientLibrary used in the Memcached Cache Provider that shipped with NHibernate 2.1.2 (and older) has issues with Memcached 1.4.4 (and newer)
Here's the error I'm getting:
Error deleting key: XXXX@YYYY#121271. Server response: CLIENT_ERROR bad command line format. Usage: delete <key> [noreply]
From what I read in memcached release notes 1.4.4, looks like Memcached 1.2.x used to support so called lingering delete. This is when the client sends the delete command with an optional timeout parameter set to a non-zero value. This causes the server to flag the item as deleted but still keep in the cache (until the timeout expires) -- this way the subsequent add operations would fail. This rather obscure feature was removed completely in 1.4.0, but 1.4.4 introduced a backwards compatibility change that allows the timeout value of 0 (i.e. non-lingering delete), while continuing to reject others.
Looking at NHibernate.Caches.MemCache.MemCacheClient's method I see the following code:
this.client.Delete(this.KeyAsString(key), DateTime.Now.AddSeconds((double) this.expiry));
So we have two options: keep NH wrapper supplying an expiration date and making Memcached.ClientLibrary.MemcachedClient ignore it OR modify NHibernate.Caches.MemCache.MemCacheClient to not supply expiration date. I'm inclined towards second option, but can it be hardcoded or should I make it configurable?
Here's my post to NHContrib group: http://groups.google.com/group/nhcdevs/browse_thread/thread/14630c7fe6f9a18e
And here's JIRA ticket: NHCH-27
Tags: