首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Memcached .Net客户端BufferedStream错误

Memcached .Net客户端BufferedStream错误
EN

Stack Overflow用户
提问于 2012-09-04 22:21:26
回答 1查看 1.5K关注 0票数 3

我正在尝试使用Memcached.ClientLibrary。我可以让它和所有的东西工作,但在几次点击之后(甚至在我第一次看到页面之前),我得到了这个奇怪的错误,我在搜索它时找不到任何信息。

错误消息:

如果底层流不可查找,则读取缓冲区不为空时,无法写入BufferedStream。确保此BufferedStream的底层流能够在此BufferedStream上寻找或避免交织、读和写操作。

堆栈跟踪:

代码语言:javascript
复制
[NotSupportedException: Cannot write to a BufferedStream while the read buffer is not empty if the underlying stream is not seekable. Ensure that the stream underlying this BufferedStream can seek or avoid interleaving read and write operations on this BufferedStream.]
System.IO.BufferedStream.ClearReadBufferBeforeWrite() +10447571
System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count) +163
Memcached.ClientLibrary.SockIO.Write(Byte[] bytes, Int32 offset, Int32 count) in C:\devroot\memcacheddotnet\trunk\clientlib\src\clientlib\SockIO.cs:411
Memcached.ClientLibrary.SockIO.Write(Byte[] bytes) in C:\devroot\memcacheddotnet\trunk\clientlib\src\clientlib\SockIO.cs:391
Memcached.ClientLibrary.MemcachedClient.Set(String cmdname, String key, Object obj, DateTime expiry, Object hashCode, Boolean asString) in C:\devroot\memcacheddotnet\trunk\clientlib\src\clientlib\MemCachedClient.cs:766
Memcached.ClientLibrary.MemcachedClient.Set(String key, Object value, DateTime expiry) in C:\devroot\memcacheddotnet\trunk\clientlib\src\clientlib\MemCachedClient.cs:465
Yuusoft.Julian.Server.Models.Utils.Caching.CacheWrapper.Add(CacheKey key, T o, CacheDependency dependencies, Nullable`1 expirationTime, CacheItemRemovedCallback callBack)

我的初始化代码(静态构造函数):

代码语言:javascript
复制
        SockIOPool pool = SockIOPool.GetInstance();
        pool.SetServers(CacheWrapper.Servers);

        pool.InitConnections = 3;
        pool.MinConnections = 1;
        pool.MaxConnections = 50;

        pool.SocketConnectTimeout = 1000;
        pool.SocketTimeout = 3000;

        pool.MaintenanceSleep = 30;
        pool.Failover = true;

        pool.Nagle = false;
        pool.Initialize();

//代码设置(第二个是错误的,但不是在第一个命中?!)

代码语言:javascript
复制
        MemcachedClient mc = new MemcachedClient();
        mc.Set(key, o, expirationTime.Value);

//代码获取

代码语言:javascript
复制
        MemcachedClient mc = new MemcachedClient();
        object o = mc.Get(key);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-28 04:17:11

除了这个异常之外,下面两个异常也出现在我的memcached log4net Memcached.ClientLibrary日志(Error storing data in cache for key:<key with spaces>Exception thrown while trying to get object from cache for key:<key with spaces>)中,我能够通过确保memcached键不包含任何空格来解决这三个异常。

Reference:https://groups.google.com/forum/#!topic/memcached/4WMcTbL8ZZY

Memcached版本: memcached-win32-1.4.4-14

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12272134

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档