MemcachedClient and AsyncMemcachedClient classes can be created from a configuration file. An XSD for the configuration is included in the solution specifically for intellisense purposes. Place the NMemcachedConfiguration.xsd file in the <VSInstall>\Xml\Schemas directory and add the xmlns="" attribute to the <nmemcached.client> element.

<?xml version="1.0"?>
          <section name="nmemcached.client" type="NMemcached.Client.Configuration.NMemcachedConfigurationSection, NMemcached.Client" allowLocation="true" allowDefinition="Everywhere"/>
     <nmemcached.client xmlns="">
              <add server="" />

The connection provider element has an optional "hashAlgorithm" attribute that sets the algorithm for the consistent key hashing. The following hash algorithms can be specified:
  • fnv32
  • fnv1a32 (default)
  • fnv64
  • fnv1a64
  • md5
  • sha1
  • sha256
  • sha384
  • sha512

Any number of servers can be added to the <connectionProvider> element and each one can have its own configuration. The <add> element within the <connectionProvider> element only requires the "server" attribute that specifies the host name or IP without a scheme or port number. The rest of the attributes are optional:
Attribute Default Value Valid Values Notes
port 11211 Any valid IP port
protocol text text, binary The Memcached protocol format
transport tcp tcp, udp, connectionOriented, connectionless The transport protocol for the connection. UDP transport is only available when using the binary protocol
useCompression false true, false Compression is at the data level. Compression is performed immediately prior to sending and decompression is done immediately after receiving
compressionAlgorithm GZip GZip, Deflate
payloadEncoding UTF8 ASCII, BigEndianUnicode, Unicode, UTF32, UTF 7, UTF8 The encoding used for cached data
protocolEncoding UTF8 ASCII, BigEndianUnicode, Unicode, UTF32, UTF 7, UTF8 The encoding of the commands sent to the server when using the text protocol
sendTimeout 5000 Any positive integer
receiveTimeout 5000 Any positivie integer

Last edited Dec 7, 2011 at 5:39 PM by JSanford42, version 1


No comments yet.