NorthscaleClient 未一致地设置值
我正在使用 Enyim Memcached 客户端库中的 NorthscaleClient
将对象存储在 Northscale Memcached 服务器。下面的工作并不一致,断言大多数时候都会失败。我做错了什么吗?
// File size is 360kb
var reader = File.ReadAllText(@"c:\RHDSetup.log");
for (int i = 0; i < 10; i++)
{
Assert.True(new NorthScaleClient(c).Store(StoreMode.Set, i.ToString(),
reader));
Thread.Sleep(1000);
}
I am using NorthscaleClient
from Enyim Memcached client libary to store objects in Northscale Memcached Server. Below does not work consistently, assertion fails most of the time. Am I doing anything wrong?
// File size is 360kb
var reader = File.ReadAllText(@"c:\RHDSetup.log");
for (int i = 0; i < 10; i++)
{
Assert.True(new NorthScaleClient(c).Store(StoreMode.Set, i.ToString(),
reader));
Thread.Sleep(1000);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是 new NorthScaleClient(c).Store(StoreMode.Set, i.ToString(),
reader) 在
Assert.True
方法中。删除内联调用并在外部初始化后效果很好。我想,有时对象可能超出范围并且断言失败。The problem was the usage of
new NorthScaleClient(c).Store(StoreMode.Set, i.ToString(),
insidereader)
Assert.True
method. After removing inline call and initializing it outside works well. I guess, it is probably sometimes the object goes out of scope and assertion fails.