memcached server: memcached_1.26_forwin32.exe
memcached client:enyim.caching.2.10
Client 配置:
<configSections>
<sectionGroup name="enyim.com">
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching"/>
<!-- log -->
<section name="log" type="Enyim.Caching.Configuration.LoggerSection, Enyim.Caching" />
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<enyim.com>
<memcached protocol="Binary">
<servers>
<add address="localhost" port="11211"/>
</servers>
<socketPool minPoolSize="10" maxPoolSize="100" connectionTimeout="00:00:10" deadTimeout="00:02:00"/>
</enyim.com>
<!--......-->
代码:
static void Main(string[] args)
{
MemcachedClient memClient = new MemcachedClient();
memClient.Store(Enyim.Caching.Memcached.StoreMode.Add, "MYKEY", "This is store in memcached server value!");
Console.WriteLine(memClient.Get("MYKEY"));
Console.ReadKey();
}
日志:
2011-07-04 14:20:42,834 [9] DEBUG Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Pool has been inited for 127.0.0.1:11211 with 10 sockets
2011-07-04 14:20:42,844 [9] DEBUG Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Acquiring stream from pool. 127.0.0.1:11211
2011-07-04 14:20:42,846 [9] DEBUG Enyim.Caching.Memcached.PooledSocket - Socket 3bdb2579-36b4-48f4-bdb4-ef4cd53c0dd4 was reset
2011-07-04 14:20:42,846 [9] DEBUG Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Socket was reset. 3bdb2579-36b4-48f4-bdb4-ef4cd53c0dd4
2011-07-04 14:20:53,397 [9] ERROR Enyim.Caching.Memcached.MemcachedNode - System.IO.IOException: Failed to read from the socket '127.0.0.1:11211'. Error: TimedOut
at Enyim.Caching.Memcached.PooledSocket.BasicNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count) in d:\Dropbox\repo\EnyimMemcached\Enyim.Caching\Memcached\PooledSocket.cs:line 365
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at Enyim.Caching.Memcached.PooledSocket.Read(Byte[] buffer, Int32 offset, Int32 count) in d:\Dropbox\repo\EnyimMemcached\Enyim.Caching\Memcached\PooledSocket.cs:line 221
at Enyim.Caching.Memcached.Protocol.Binary.BinaryResponse.Read(PooledSocket socket) in d:\Dropbox\repo\EnyimMemcached\Enyim.Caching\Memcached\Protocol\Binary\BinaryResponse.cs:line 57
at Enyim.Caching.Memcached.Protocol.Binary.BinarySingleItemOperation.ReadResponse(PooledSocket socket) in d:\Dropbox\repo\EnyimMemcached\Enyim.Caching\Memcached\Protocol\Binary\BinarySingleItemOperation.cs:line 22
at Enyim.Caching.Memcached.Protocol.Operation.Enyim.Caching.Memcached.IOperation.ReadResponse(PooledSocket socket) in d:\Dropbox\repo\EnyimMemcached\Enyim.Caching\Memcached\Protocol\Operation.cs:line 26
at Enyim.Caching.Memcached.MemcachedNode.ExecuteOperation(IOperation op) in d:\Dropbox\repo\EnyimMemcached\Enyim.Caching\Memcached\MemcachedNode.cs:line 474
2011-07-04 14:20:53,413 [9] DEBUG Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Releasing socket 3bdb2579-36b4-48f4-bdb4-ef4cd53c0dd4
2011-07-04 14:20:53,413 [9] DEBUG Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Are we alive? True
2011-07-04 14:20:53,415 [9] WARN Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Marking node 127.0.0.1:11211 as dead
2011-07-04 14:20:53,417 [9] DEBUG Enyim.Caching.Memcached.DefaultServerPool - Node 127.0.0.1:11211 is dead.
2011-07-04 14:20:53,417 [9] DEBUG Enyim.Caching.Memcached.DefaultServerPool - Starting the recovery timer.
2011-07-04 14:20:53,419 [9] DEBUG Enyim.Caching.Memcached.DefaultServerPool - Timer started.
请问 这是什么原因啊!?有朋友遇到过么?
2011-07-04 15:19:08,781 [8] DEBUG Enyim.Caching.Memcached.PooledSocket - Socket 0c7aecaa-dd89-421c-96e2-987abb1125c0 was reset
2011-07-04 15:19:08,781 [8] DEBUG Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Socket was reset. 0c7aecaa-dd89-421c-96e2-987abb1125c0
2011-07-04 15:19:19,321 [8] ERROR Enyim.Caching.Memcached.MemcachedNode - System.IO.IOException: Failed to read from the socket '127.0.0.1:11211'. Error: TimedOut
at Enyim.Caching.Memcached.PooledSocket.BasicNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at Enyim.Caching.Memcached.PooledSocket.Read(Byte[] buffer, Int32 offset, Int32 count)
at Enyim.Caching.Memcached.Protocol.Binary.BinaryResponse.Read(PooledSocket socket)
at Enyim.Caching.Memcached.Protocol.Binary.BinarySingleItemOperation.ReadResponse(PooledSocket socket)
at Enyim.Caching.Memcached.Protocol.Operation.Enyim.Caching.Memcached.IOperation.ReadResponse(PooledSocket socket)
at Enyim.Caching.Memcached.MemcachedNode.ExecuteOperation(IOperation op)
2011-07-04 15:19:19,338 [8] DEBUG Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Releasing socket 0c7aecaa-dd89-421c-96e2-987abb1125c0
2011-07-04 15:19:19,339 [8] DEBUG Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Are we alive? True
2011-07-04 15:19:19,343 [8] WARN Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Marking node 127.0.0.1:11211 as dead
我把 <memcached protocol="Binary"> 改成 <memcached protocol="Text"> 又不报错了,这是怎么一回事哪,遇到的同学帮帮我吧?
https://github.com/enyim/EnyimMemcached/downloads
memcached_1.26_forwin32.exe 不支持二进制协议 使用Linux下memcached吧
你好,可以把这个Demo发给我一下吗?我去115网盘下载不了