This project is read-only.
netcached is a lightweight, high performance .NET client for memcached protocol. It is fully compliant with Memcached protocol and also has support for in-memory databases such as Couchbase (formerly Membase).

Note: Full technical documentation coming soon

Source code is available for download here and for browsing here.

Key features

  • supports all operations compliant with Memcached protocol
  • consistent hashing and key distribution over multiple servers (Ketama implementation)
  • socket pooling and reuse for high performance read/write operations
  • concurrency handling for multithreaded environments
  • optional data compression using Deflate and GZip algorithms
  • serialization of all data types

Coming soon
  • support for vBuckets
  • server statistics and analysis

Usage examples

Client creation and configuration
// Create client from configuration (App.config)
MemcachedClient client = MemcachedClient.CreateFromConfiguration();

// Create client manually
MemcachedClient client = new MemcachedClient("localhost", 11211);

Basic operations
client.Set("someKey", "some value...");

string fetchedValue = client.Get<string>("someKey");  // Read the stored value

// Multi-get
string[] keys = new string[] {"key1", "key2", "key3"};
List<RetrievedItem> items = client.Get(keys);

// delete all entries on all servers

XML configuration (App and Web config)
<?xml version="1.0" encoding="utf-8" ?>
    <section name="netcached" type="Netcached.Configuration.NetcachedConfigurationSection, Netcached" />
  <netcached maxSocketsPerServer = "5" compressionAlgorithm="Deflate" compressionThreshold ="512">
      <add address="localhost" port="11211" sendReceiveTimeout="1100" />
      <add address="" port="11211" sendReceiveTimeout="500" />

Last edited Nov 14, 2012 at 4:48 PM by VedranK, version 7