1

I have ASP.Net project and I'm using Memcached for data and session caching. I also need to use the compress options of Memcached. I'd appreciate that if you can share your comments with me! I have found some sites but they don't have any c#.Net code samples.

PHeiberg
  • 29,411
  • 6
  • 59
  • 81
Nurhak Kaya
  • 1,470
  • 1
  • 18
  • 20
  • which memcached client-library are you using? – Marc Gravell Aug 16 '12 at 11:05
  • That's Enyim Memcached Client. – Nurhak Kaya Aug 16 '12 at 11:07
  • k; last time I looked, memcached didn't have compression at the *server*; has this changed? or is this a feature of the *client library*? or is it something you are doing manually? – Marc Gravell Aug 16 '12 at 11:12
  • I think it's a feature of the client library, so that when you change the compression option in you application, then your compression options tell Memcached to compress the data if it can. There is an article here about this feature. http://benrobb.com/wp-content/uploads/2009/01/memcached.pdf – Nurhak Kaya Aug 16 '12 at 11:24
  • @NurhakKaya - As @MarcGravell says, the compression is made on the client side. If you look at the beitmemcached [source code](http://code.google.com/p/beitmemcached/source/browse/trunk/ClientLibrary/Serializer.cs) you can see how it's made (check the `Serializer` class' `Serialize` method). – PHeiberg Aug 16 '12 at 11:37
  • @PHeiberg I have checked the Serializer class of BeITMemcached client which looks pretty good actually but I want to find another solution with Enyim If I can. Thank you guys for your answers. – Nurhak Kaya Aug 16 '12 at 12:42

1 Answers1

1

According to this comparison of memcached clients, the Enyim doesn't provide built in compression support.

The beitmemcached library however has. The Feature Description says it's automatically compressing all objects exceeding a certain threshhold.

Compression

The client also supports compression for storing large objects. It uses the built-in DeflateStream compression, which compresses data into the Deflate format. If the bytearray that is to be stored is larger than the value specified in the property CompressionThreshold, the data will be compressed before stored in the memcached servers, and automatically decompressed when retrived. The default value of CompressionThreshold is 128 kB.

PHeiberg
  • 29,411
  • 6
  • 59
  • 81